summaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorGlenn L McGrath2001-11-03 08:29:35 +0000
committerGlenn L McGrath2001-11-03 08:29:35 +0000
commit0a25b35c66724e448a12dcbe51bddcd317dc275d (patch)
tree93144888cc0b9e98b4c6abe8f164bd4d58cb3175 /archival
parent55b2deda088ce2ce21ea059ca26783baffa778a9 (diff)
downloadbusybox-0a25b35c66724e448a12dcbe51bddcd317dc275d.zip
busybox-0a25b35c66724e448a12dcbe51bddcd317dc275d.tar.gz
Fix create list segfault
Diffstat (limited to 'archival')
-rw-r--r--archival/dpkg.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c
index ec199a7..88cf8b8 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -1041,7 +1041,8 @@ char **create_list(const char *filename)
return(file_list);
}
while (getline(&line, &length, list_stream) != -1) {
- file_list = xrealloc(file_list, sizeof(char *) * (length + 1));
+ /* +2 as we need to include space for the terminating NULL pointer */
+ file_list = xrealloc(file_list, sizeof(char *) * (length + 2));
last_char = last_char_is(line, '\n');
if (last_char) {
*last_char = '\0';