From 28610ff9a604a75ae0c383be03aa19415ddb1965 Mon Sep 17 00:00:00 2001 From: David Levine Date: Sat, 28 Dec 2013 11:54:05 -0600 Subject: [PATCH] Null-terminate buffer in mbx_copy() in dropsbr.c. Noticed by valgrind. --- uip/dropsbr.c | 4 ++++ 1 file changed, 4 insertions(+) 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]++) -- 2.56.0