[PATCH] _metadata_to_annotate(): Reserve space for terminating zero

Thomas Jarosch thomas.jarosch at intra2net.com
Tue Jul 21 06:03:26 EDT 2015


Affects 2.5 and git HEAD, patch against git HEAD.

cppcheck reported:
Dangerous usage of strncat - 3rd parameter is the maximum number of characters to append.
---
 imap/imapd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/imap/imapd.c b/imap/imapd.c
index 687c4af..c130a59 100644
--- a/imap/imapd.c
+++ b/imap/imapd.c
@@ -9628,7 +9628,7 @@ static int _metadata_to_annotate(const strarray_t *entries,
      * the old annotation system works. */
     for (i = 0 ; i < entries->count ; i++) {
         char *ent = entries->data[i];
-        char entry[MAX_MAILBOX_NAME];
+        char entry[MAX_MAILBOX_NAME+1];
 
         lcase(ent);
         /* there's no way to perfect this - unfortunately - the old style
-- 
1.9.3



More information about the Cyrus-devel mailing list