summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-04-20 00:10:12 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-04-20 00:10:12 +0000
commit8f64aa406d22388ceb59f21770e455c311be0934 (patch)
treecab08cea44058d7dd659580d1ff68c5c31012ac4
parent7754afb8bf1b99b7f7008af459ba3e3fa0095da5 (diff)
Fix an incorrect memset() in __grow_type_table(); dk@homepage.ru
While I was there I noticed and fixed a bogus realloc(). We should really check malloc/realloc return values and deal sanely but that will have to be done later. Theo OK'd
-rw-r--r--lib/libc/stdio/vfprintf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c
index 1aa62dcbf98..fc33fb971f3 100644
--- a/lib/libc/stdio/vfprintf.c
+++ b/lib/libc/stdio/vfprintf.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: vfprintf.c,v 1.9 1999/08/22 17:06:35 millert Exp $";
+static char *rcsid = "$OpenBSD: vfprintf.c,v 1.10 2001/04/20 00:10:11 millert Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -1079,13 +1079,14 @@ __grow_type_table(typetable, tablesize)
if (*tablesize == STATIC_ARG_TBL_SIZE) {
*typetable = (unsigned char *)
malloc (sizeof (unsigned char) * newsize);
+ /* XXX unchecked */
bcopy (oldtable, *typetable, *tablesize);
} else {
*typetable = (unsigned char *)
- realloc (typetable, sizeof (unsigned char) * newsize);
+ realloc (*typetable, sizeof (unsigned char) * newsize);
/* XXX unchecked */
}
- memset (&typetable [*tablesize], T_UNUSED, (newsize - *tablesize));
+ memset (*typetable + *tablesize, T_UNUSED, (newsize - *tablesize));
*tablesize = newsize;
return(0);