- Grr! unterminated buffer string in exclude destination buffer

- fix isfoo() ctype macros to take unsigned char.
This commit is contained in:
christos 2004-07-14 12:41:36 +00:00
parent 106472864c
commit 71f73d1673

View File

@ -1,4 +1,4 @@
/* $NetBSD: tar.c,v 1.56 2004/06/16 14:26:24 christos Exp $ */
/* $NetBSD: tar.c,v 1.57 2004/07/14 12:41:36 christos Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94";
#else
__RCSID("$NetBSD: tar.c,v 1.56 2004/06/16 14:26:24 christos Exp $");
__RCSID("$NetBSD: tar.c,v 1.57 2004/07/14 12:41:36 christos Exp $");
#endif
#endif /* not lint */
@ -1302,10 +1302,12 @@ tar_gnutar_exclude_one(const char *line, size_t len)
else if (line[i] == '?') {
sbuf[j++] = '.';
continue;
} else if (!isalnum(line[i]) && !isblank(line[i]))
} else if (!isalnum((unsigned char)line[i]) &&
!isblank((unsigned char)line[i]))
sbuf[j++] = '\\';
sbuf[j++] = line[i];
}
sbuf[j] = '\0';
/* don't need the .*\/ ones if we start with /, i guess */
if (line[0] != '/') {
(void)snprintf(rabuf, sizeof rabuf, "/.*\\/%s$//", sbuf);