commit - fae40e36ea831cb0bccfe17a88f52f7451dd013e
commit + 8914529dc5d3a0f394dbcc3e90fd63ba329bb824
blob - 20bd1a170fc63b0edd610524b6a28970c9d6fee8
blob + 0fe7cbd09118fad59fdb3a386a21b4f6883aefd7
--- lib/object_parse.c
+++ lib/object_parse.c
parse_tree_entry(struct got_tree_entry **te, size_t *elen, char *buf,
size_t maxlen)
{
- char *p = buf, *space;
+ char *p, *space;
const struct got_error *err = NULL;
*te = got_alloc_tree_entry_partial();
}
space = memchr(buf, ' ', *elen);
- if (space == NULL) {
+ if (space == NULL || space <= buf) {
err = got_error(GOT_ERR_BAD_OBJ_DATA);
free(*te);
*te = NULL;
return err;
}
(*te)->mode = 0;
- while (*p != ' ') {
+ p = buf;
+ while (p < space) {
if (*p < '0' && *p > '7') {
err = got_error(GOT_ERR_BAD_OBJ_DATA);
goto done;