mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-09 15:00:04 +00:00
oid: now git_oid_fromstrn checks whether the given string is too short
Signed-off-by: J. David Ibáñez <jdavid.ibp@gmail.com>
This commit is contained in:
parent
6d8d3f195c
commit
b9caa1859d
@ -36,6 +36,9 @@ int git_oid_fromstrn(git_oid *out, const char *str, size_t length)
|
|||||||
size_t p;
|
size_t p;
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
|
if (length < 4)
|
||||||
|
return git__throw(GIT_ENOTOID, "Failed to generate sha1. Given string is too short");
|
||||||
|
|
||||||
if (length > GIT_OID_HEXSZ)
|
if (length > GIT_OID_HEXSZ)
|
||||||
length = GIT_OID_HEXSZ;
|
length = GIT_OID_HEXSZ;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user