diff options
author | kim <kim@pkgsrc.org> | 2004-07-28 02:50:22 +0000 |
---|---|---|
committer | kim <kim@pkgsrc.org> | 2004-07-28 02:50:22 +0000 |
commit | 115019401605e0a0227b971eda50a31dddeccac7 (patch) | |
tree | 6f07b358ea6a9ddf4efdbc93005d445e05f53978 /databases/abook/patches | |
parent | 5a4e75ef0dbfbe472daed99a61461c796830b3ba (diff) | |
download | pkgsrc-115019401605e0a0227b971eda50a31dddeccac7.tar.gz |
Add a patch from abook CVS to fix string truncation in mutt import filter.
Diffstat (limited to 'databases/abook/patches')
-rw-r--r-- | databases/abook/patches/patch-aa | 40 |
1 files changed, 40 insertions, 0 deletions
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 <jheinonen@users.sourceforge.net> + * +@@ -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++; |