diff options
author | Patrick Steinhardt <ps@pks.im> | 2019-12-13 13:18:54 +0100 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2019-12-13 13:22:56 +0100 |
commit | c6f9ad73e25f2abb1c25d50795b0b571305d43a4 (patch) | |
tree | d6f41a45edc89010e9d8316a0d97102fbf5e6834 /src/commit.c | |
parent | 3e6a9045213268089b567d7a6f7ccf30374b32b7 (diff) | |
download | libgit2-c6f9ad73e25f2abb1c25d50795b0b571305d43a4.tar.gz |
patch_parse: fix undefined behaviour due to arithmetic on NULL pointers
Doing arithmetic with NULL pointers is undefined behaviour in the C
standard. We do so regardless when parsing patches, as we happily add a
potential prefix length to prefixed paths. While this works out just
fine as the prefix length is always equal to zero in these cases, thus
resulting in another NULL pointer, it still is undefined behaviour and
was pointed out to us by OSSfuzz.
Fix the issue by checking whether paths are NULL, avoiding the
arithmetic if they are.
Diffstat (limited to 'src/commit.c')
0 files changed, 0 insertions, 0 deletions