]> granicus.if.org Git - sudo/commitdiff
Add check for I/O log file handle being NULL. This could only
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 25 Jan 2016 23:18:22 +0000 (16:18 -0700)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 25 Jan 2016 23:18:22 +0000 (16:18 -0700)
happen if the front-end calls iolog_open with argc == 0 but actually
runs a command.

plugins/sudoers/iolog.c

index c7b4584cda4c3a6a47ed01f47ec497a34eeee22a..6b33c195bedf1bf26d3dff778cc4b4905a35e3e0 100644 (file)
@@ -719,6 +719,12 @@ sudoers_io_log(const char *buf, unsigned int len, int idx)
     int rval = true;
     debug_decl(sudoers_io_version, SUDOERS_DEBUG_PLUGIN)
 
+    if (io_log_files[idx].fd.v == NULL) {
+       sudo_warnx(U_("%s: internal error, file index %d not open"),
+           __func__, idx);
+       debug_return_int(-1);
+    }
+
     gettimeofday(&now, NULL);
 
 #ifdef HAVE_ZLIB_H