Commit b9caa185 by J. David Ibáñez

oid: now git_oid_fromstrn checks whether the given string is too short

Signed-off-by: J. David Ibáñez <jdavid.ibp@gmail.com>
parent 6d8d3f19
...@@ -36,6 +36,9 @@ int git_oid_fromstrn(git_oid *out, const char *str, size_t length) ...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment