vendor/libgit2/src/signature.c in rugged-0.24.0b2 vs vendor/libgit2/src/signature.c in rugged-0.24.0b3

- old
+ new

@@ -32,16 +32,30 @@ static bool contains_angle_brackets(const char *input) { return strchr(input, '<') != NULL || strchr(input, '>') != NULL; } +static bool is_crud(unsigned char c) +{ + return c <= 32 || + c == '.' || + c == ',' || + c == ':' || + c == ';' || + c == '<' || + c == '>' || + c == '"' || + c == '\\' || + c == '\''; +} + static char *extract_trimmed(const char *ptr, size_t len) { - while (len && git__isspace(ptr[0])) { + while (len && is_crud((unsigned char)ptr[0])) { ptr++; len--; } - while (len && git__isspace(ptr[len - 1])) { + while (len && is_crud((unsigned char)ptr[len - 1])) { len--; } return git__substrdup(ptr, len); }