]> diplodocus.org Git - nmh/commitdiff
Null-terminate buffer in mbx_copy() in dropsbr.c. Noticed by
authorDavid Levine <levinedl@acm.org>
Sat, 28 Dec 2013 17:54:05 +0000 (11:54 -0600)
committerDavid Levine <levinedl@acm.org>
Sat, 28 Dec 2013 17:54:05 +0000 (11:54 -0600)
valgrind.

uip/dropsbr.c

index 7dc0a87..2cf5b59 100644 (file)
@@ -306,6 +306,10 @@ mbx_copy (char *mailbox, int mbx_style, int md, int fd,
            }
                    
            while ((i = read (fd, buffer, sizeof(buffer))) > 0) {
+                /* valgrind noticed that stringdex depends on null
+                   termination. */
+                buffer[i] = '\0';
+
                for (j = 0;
                        (j = stringdex (mmdlm1, buffer)) >= 0;
                        buffer[j]++)