summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorewt <devnull@localhost>1998-03-27 17:23:20 +0000
committerewt <devnull@localhost>1998-03-27 17:23:20 +0000
commit0d6558640497de83dec5902e972f84f289b84ba4 (patch)
tree08e87bda2f04092a6171931f39a70ce4956eb5d9
parent8cfbc0ef42dd0cde5110cb433c0407ee1f8cfe56 (diff)
downloadlibrpm-tizen-0d6558640497de83dec5902e972f84f289b84ba4.tar.gz
librpm-tizen-0d6558640497de83dec5902e972f84f289b84ba4.tar.bz2
librpm-tizen-0d6558640497de83dec5902e972f84f289b84ba4.zip
strntoul() was returning a pointer into alloca()'s memory
CVS patchset: 2051 CVS date: 1998/03/27 17:23:20
-rw-r--r--lib/cpio.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/cpio.c b/lib/cpio.c
index 7b5c856bc..c3069ab3c 100644
--- a/lib/cpio.c
+++ b/lib/cpio.c
@@ -123,12 +123,19 @@ static inline int padoutfd(int fd, size_t * where, int modulo) {
}
static int strntoul(const char * str, char ** endptr, int base, int num) {
- char * buf;
+ char * buf, * end;
+ unsigned long return;
buf = alloca(num + 1);
strncpy(buf, str, num);
buf[num] = '\0';
+ ret = strtoul(buf, &end, base);
+ if (*end)
+ *endptr = str + (end - buf);
+ else
+ *endptr = "";
+
return strtoul(buf, endptr, base);
}