Add a patch from abook CVS to fix string truncation in mutt import filter.

This commit is contained in:
kim 2004-07-28 02:50:22 +00:00
parent 5a4e75ef0d
commit 1150194016
3 changed files with 44 additions and 2 deletions

View file

@ -1,7 +1,8 @@
# $NetBSD: Makefile,v 1.8 2004/06/28 19:23:53 minskim Exp $
# $NetBSD: Makefile,v 1.9 2004/07/28 02:50:22 kim Exp $
#
DISTNAME= abook-0.5.2
PKGREVISION= 1
CATEGORIES= databases
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=abook/}

View file

@ -1,4 +1,5 @@
$NetBSD: distinfo,v 1.3 2004/06/28 19:22:38 minskim Exp $
$NetBSD: distinfo,v 1.4 2004/07/28 02:50:22 kim Exp $
SHA1 (abook-0.5.2.tar.gz) = 08f7382bd1a085172c9471922bcc984aa131eb80
Size (abook-0.5.2.tar.gz) = 183852 bytes
SHA1 (patch-aa) = 3135f0899056ea540bdf76c0bc583e48696af6fb

View file

@ -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++;