Fix overflow
authorColin Leroy <colin@colino.net>
Fri, 13 Nov 2015 09:17:25 +0000 (10:17 +0100)
committerColin Leroy <colin@colino.net>
Fri, 13 Nov 2015 09:17:25 +0000 (10:17 +0100)
src/plugins/mailmbox/mailmbox_types.c

index 0605a89..8495d8c 100644 (file)
@@ -192,8 +192,8 @@ struct claws_mailmbox_folder * claws_mailmbox_folder_new(const char * mb_filenam
   if (folder == NULL)
     goto err;
 
   if (folder == NULL)
     goto err;
 
-  strncpy(folder->mb_filename, mb_filename, PATH_MAX);
-
+  strncpy(folder->mb_filename, mb_filename, PATH_MAX - 1);
+  folder->mb_filename[PATH_MAX - 1] = '\0';
   folder->mb_mtime = (time_t) -1;
 
   folder->mb_fd = -1;
   folder->mb_mtime = (time_t) -1;
 
   folder->mb_fd = -1;