diff options
author | Ed Maste <emaste@FreeBSD.org> | 2023-09-05 16:35:31 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2023-09-07 14:36:50 +0000 |
commit | ee12faa062c04a49bf6fe4e6867bad8606e2413f (patch) | |
tree | aae1a11d1c443b55ee218661f8c7aeaccb4773e4 /usr.bin/bsdiff/bspatch/bspatch.c | |
parent | 5f62584a9adb7887bae33af617cfa4f43017abf8 (diff) |
Diffstat (limited to 'usr.bin/bsdiff/bspatch/bspatch.c')
-rw-r--r-- | usr.bin/bsdiff/bspatch/bspatch.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/usr.bin/bsdiff/bspatch/bspatch.c b/usr.bin/bsdiff/bspatch/bspatch.c index a596ab1837dd..d7fabddabbfe 100644 --- a/usr.bin/bsdiff/bspatch/bspatch.c +++ b/usr.bin/bsdiff/bspatch/bspatch.c @@ -36,6 +36,7 @@ #include <fcntl.h> #include <libgen.h> #include <limits.h> +#include <stdckdint.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> @@ -64,15 +65,8 @@ add_off_t(off_t a, off_t b) { off_t result; -#if __GNUC__ >= 5 || \ - (defined(__has_builtin) && __has_builtin(__builtin_add_overflow)) - if (__builtin_add_overflow(a, b, &result)) + if (ckd_add(&result, a, b)) errx(1, "Corrupt patch"); -#else - if ((b > 0 && a > OFF_MAX - b) || (b < 0 && a < OFF_MIN - b)) - errx(1, "Corrupt patch"); - result = a + b; -#endif return result; } |