From 0a25b35c66724e448a12dcbe51bddcd317dc275d Mon Sep 17 00:00:00 2001 From: Glenn L McGrath Date: Sat, 3 Nov 2001 08:29:35 +0000 Subject: [PATCH] Fix create list segfault --- archival/dpkg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/archival/dpkg.c b/archival/dpkg.c index ec199a72c..88cf8b872 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'; -- 2.25.1