Check fdopen return value, from Christian Menges.

This commit is contained in:
nicm 2023-06-21 06:28:18 +00:00
parent bdd05bdbd3
commit 645bf8b3ab

View File

@ -788,6 +788,8 @@ popup_editor(struct client *c, const char *buf, size_t len,
if (fd == -1) if (fd == -1)
return (-1); return (-1);
f = fdopen(fd, "w"); f = fdopen(fd, "w");
if (f == NULL)
return (-1);
if (fwrite(buf, len, 1, f) != 1) { if (fwrite(buf, len, 1, f) != 1) {
fclose(f); fclose(f);
return (-1); return (-1);