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

ellie timoney ellie at fastmail.com
Wed Jul 22 20:08:53 EDT 2015


Hi Thomas,

Thanks for the patch.  I've applied it to the master and cyrus-imapd-2.5
branches.

It'll be included in the next release of 2.5.

Cheers,

ellie

On Tue, Jul 21, 2015, at 08:03 PM, Thomas Jarosch wrote:
> 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