diff options
-rw-r--r-- | archival/dpkg.c | 6 | ||||
-rw-r--r-- | dpkg.c | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c index 95c8b88cb..d566bfe5b 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c | |||
@@ -769,7 +769,11 @@ void write_status_file(deb_file_t **deb_file) | |||
769 | 769 | ||
770 | /* Update previously known packages */ | 770 | /* Update previously known packages */ |
771 | while ((control_buffer = fgets_str(old_status_file, "\n\n")) != NULL) { | 771 | while ((control_buffer = fgets_str(old_status_file, "\n\n")) != NULL) { |
772 | tmp_string = strstr(control_buffer, "Package:") + 8; | 772 | if ((tmp_string = strstr(control_buffer, "Package:")) == NULL) { |
773 | continue; | ||
774 | } | ||
775 | |||
776 | tmp_string += 8; | ||
773 | tmp_string += strspn(tmp_string, " \n\t"); | 777 | tmp_string += strspn(tmp_string, " \n\t"); |
774 | package_name = xstrndup(tmp_string, strcspn(tmp_string, "\n\0")); | 778 | package_name = xstrndup(tmp_string, strcspn(tmp_string, "\n\0")); |
775 | write_flag = FALSE; | 779 | write_flag = FALSE; |
@@ -769,7 +769,11 @@ void write_status_file(deb_file_t **deb_file) | |||
769 | 769 | ||
770 | /* Update previously known packages */ | 770 | /* Update previously known packages */ |
771 | while ((control_buffer = fgets_str(old_status_file, "\n\n")) != NULL) { | 771 | while ((control_buffer = fgets_str(old_status_file, "\n\n")) != NULL) { |
772 | tmp_string = strstr(control_buffer, "Package:") + 8; | 772 | if ((tmp_string = strstr(control_buffer, "Package:")) == NULL) { |
773 | continue; | ||
774 | } | ||
775 | |||
776 | tmp_string += 8; | ||
773 | tmp_string += strspn(tmp_string, " \n\t"); | 777 | tmp_string += strspn(tmp_string, " \n\t"); |
774 | package_name = xstrndup(tmp_string, strcspn(tmp_string, "\n\0")); | 778 | package_name = xstrndup(tmp_string, strcspn(tmp_string, "\n\0")); |
775 | write_flag = FALSE; | 779 | write_flag = FALSE; |