From: David Levine Date: Sat, 28 Dec 2013 17:54:05 +0000 (-0600) Subject: Null-terminate buffer in mbx_copy() in dropsbr.c. Noticed by X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/28610ff9a604a75ae0c383be03aa19415ddb1965?ds=inline Null-terminate buffer in mbx_copy() in dropsbr.c. Noticed by valgrind. --- diff --git a/uip/dropsbr.c b/uip/dropsbr.c index 7dc0a87b..2cf5b598 100644 --- a/uip/dropsbr.c +++ b/uip/dropsbr.c @@ -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]++)