From 28d3ec57c7a58c35820df7a2d34d0d4869540174 Mon Sep 17 00:00:00 2001 From: kim Date: Wed, 28 Jul 2004 02:50:22 +0000 Subject: Add a patch from abook CVS to fix string truncation in mutt import filter. --- databases/abook/patches/patch-aa | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 databases/abook/patches/patch-aa (limited to 'databases/abook/patches') diff --git a/databases/abook/patches/patch-aa b/databases/abook/patches/patch-aa new file mode 100644 index 00000000000..9daf8cef3a9 --- /dev/null +++ b/databases/abook/patches/patch-aa @@ -0,0 +1,40 @@ +$NetBSD: patch-aa,v 1.1 2004/07/28 02:50:22 kim Exp $ + +--- filter.c 2004/01/23 07:14:32 1.29 ++++ filter.c 2004/03/25 18:19:38 1.30 +@@ -1,6 +1,6 @@ + + /* +- * $Id: patch-aa,v 1.1 2004/07/28 02:50:22 kim Exp $ ++ * $Id: patch-aa,v 1.1 2004/07/28 02:50:22 kim Exp $ + * + * by JH + * +@@ -618,6 +618,7 @@ + mutt_read_line(FILE *in, char **alias, char **rest) + { + char *line, *ptr, *tmp; ++ size_t alias_len; + + if( !(line = ptr = getaline(in)) ) + return 1; /* error / EOF */ +@@ -640,13 +641,16 @@ + while( ! ISSPACE(*ptr) ) + ptr++; + +- if( (*alias = (char *)malloc(ptr - tmp)) == NULL) { ++ /* includes also the trailing zero */ ++ alias_len = (size_t)(ptr - tmp + 1); ++ ++ if( (*alias = (char *)malloc(alias_len)) == NULL) { + free(line); + return 1; + } + +- strncpy(*alias, tmp, ptr - tmp - 1); +- *(*alias + (ptr - tmp - 1)) = 0; ++ strncpy(*alias, tmp, alias_len - 1); ++ *(*alias + alias_len - 1) = 0; + + while(ISSPACE(*ptr)) + ptr++; -- cgit v1.2.3