lib/download.c: fix digestlen assert and add if condition to avoid misuse
This commit is contained in:
parent
2ef79bcc09
commit
d99aae586a
@ -111,8 +111,12 @@ xbps_fetch_file_dest_sha256(struct xbps_handle *xhp, const char *uri, const char
|
|||||||
assert(xhp);
|
assert(xhp);
|
||||||
assert(uri);
|
assert(uri);
|
||||||
|
|
||||||
if (digest) {
|
if (digest != NULL) {
|
||||||
assert(digestlen != XBPS_SHA256_DIGEST_SIZE);
|
assert(digestlen >= XBPS_SHA256_DIGEST_SIZE);
|
||||||
|
if (digestlen < XBPS_SHA256_DIGEST_SIZE) {
|
||||||
|
errno = ENOBUFS;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
SHA256_Init(&sha256);
|
SHA256_Init(&sha256);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user