Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Fix impossible null pointer dereference
Baptiste Daroussin committed 10 years ago
commit 8bae03c93035e115e595848fd4a262542c9af98e
parent ac5d806
1 file changed +4 -2
modified libpkg/pkg_checksum.c
@@ -737,7 +737,8 @@ pkg_checksum_validate_file(const char *path, const char *sum)
		type = PKG_HASH_TYPE_SHA256_HEX;
	} else {
		sum = strchr(sum, PKG_CKSUM_SEPARATOR);
-
		sum++;
+
		if (sum != NULL)
+
			sum++;
	}

	if (lstat(path, &st) == -1) {
@@ -800,7 +801,8 @@ pkg_checksum_validate_fileat(int rootfd, const char *path, const char *sum)
		type = PKG_HASH_TYPE_SHA256_HEX;
	} else {
		sum = strchr(sum, PKG_CKSUM_SEPARATOR);
-
		sum++;
+
		if (sum != NULL)
+
			sum++;
	}

	if (fstatat(rootfd, path, &st, AT_SYMLINK_NOFOLLOW) == -1) {