Skip to content

Commit 499a33e

Browse files
committed
pkg_generate_checsum: make it more robust
With some buggy metadata, when parsing the manifest we may end up requesting to generate the checksum for a package with files informations but no checksum associated with the files, which mean f->sum would be NULL. Accept to generate checksum in this case by processing an empty string instead of crashing because process NULL. Fixes: #2560
1 parent daf72e9 commit 499a33e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libpkg/pkg_checksum.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ pkg_checksum_generate(struct pkg *pkg, char *dest, size_t destlen,
277277
}
278278

279279
while (pkg_files(pkg, &f) == EPKG_OK) {
280-
LL_APPEND(entries, kv_new(f->path, f->sum));
280+
LL_APPEND(entries, kv_new(f->path, f->sum != NULL ? f->sum : "" ));
281281
}
282282

283283
/* Sort before hashing */

0 commit comments

Comments
 (0)