diff --git a/src/object.c b/src/object.c index 223f547..4afe1de 100644 --- a/src/object.c +++ b/src/object.c @@ -287,14 +287,13 @@ int read_diff(char* content, char* basefile_hash, ActionList* diff_out) { char* end; long actions = strtol(number_of_actions, &end, 10); - - if (end == number_of_actions || *end != '\0' || actions <= 0) { + + if (end == number_of_actions || *end != '\0' || actions < 0) { perror("ERROR: invalid number of actions in read_diff!"); + free(number_of_actions); return 0; } - free(number_of_actions); - size_t action_idx = 0; while (content[idx] && action_idx < (size_t)actions) { idx++;