Commit 41051e3f by Vicent Marti

signature: Shut up MSVC, you silly goose

parent c51880ee
......@@ -133,17 +133,14 @@ int git_signature__parse(git_signature *sig, const char **buffer_out,
if (header) {
const size_t header_len = strlen(header);
if (buffer_end - buffer < header_len || memcmp(buffer, header, header_len) != 0)
if (buffer + header_len >= buffer_end || memcmp(buffer, header, header_len) != 0)
return signature_error("expected prefix doesn't match actual");
buffer += header_len;
}
if (buffer >= buffer_end)
return signature_error("signature too short");
email_start = memrchr(buffer, '<', buffer_end - buffer);
email_end = memrchr(buffer, '>', buffer_end - buffer);
email_start = git__memrchr(buffer, '<', buffer_end - buffer);
email_end = git__memrchr(buffer, '>', buffer_end - buffer);
if (!email_start || !email_end || email_end <= email_start)
return signature_error("malformed e-mail");
......
......@@ -127,6 +127,21 @@ GIT_INLINE(const char *) git__next_line(const char *s)
return s;
}
GIT_INLINE(const void *) git__memrchr(const void *s, int c, size_t n)
{
const unsigned char *cp;
if (n != 0) {
cp = (unsigned char *)s + n;
do {
if (*(--cp) == (unsigned char)c)
return cp;
} while (--n != 0);
}
return NULL;
}
typedef int (*git__tsort_cmp)(const void *a, const void *b);
extern void git__tsort(void **dst, size_t size, git__tsort_cmp cmp);
......
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