]> ruderich.org/simon Gitweb - coloredstderr/coloredstderr.git/blobdiff - src/trackfds.h
Add more error checks.
[coloredstderr/coloredstderr.git] / src / trackfds.h
index ed2ea57738227a046ee290ded817182d9bca1e4a..00b3b6e3b55da47e7c66453e609e6b7754a6071d 100644 (file)
@@ -169,7 +169,7 @@ static char *update_environment_buffer_entry(char *x, int fd) {
     assert(fd >= 0);
 
     int length = snprintf(x, 10 + 1, "%d", fd);
-    if (length >= 10 + 1) {
+    if (length >= 10 + 1 || length <= 0 /* shouldn't happen */) {
         /* Integer too big to fit the buffer, skip it. */
 #ifdef WARNING
         warning("update_environment_buffer_entry(): truncated fd: %d [%d]\n",