diff options
author | pfg <pfg@FreeBSD.org> | 2016-12-26 16:27:01 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2016-12-26 16:27:01 +0000 |
commit | 7b9f32238b6641641aa210013fd40a039efdb8bd (patch) | |
tree | 8a6d4f6ea7f6fa26d480bb5b6a0d84918a4f8bcd /bin/ed/ed.h | |
parent | dfd254d78b6b1a0637b5ade991a21f5af55d2c0f (diff) | |
download | FreeBSD-src-7b9f32238b6641641aa210013fd40a039efdb8bd.zip FreeBSD-src-7b9f32238b6641641aa210013fd40a039efdb8bd.tar.gz |
MFC r309873:
ed(1): Prevent possible overflows during allocation.
Make sure the parameters used for malloc(3) can hold size_t sizes.
This should help ed(1) handle bigger data in the future.
Diffstat (limited to 'bin/ed/ed.h')
-rw-r--r-- | bin/ed/ed.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/ed/ed.h b/bin/ed/ed.h index 8cb8cec..597e346 100644 --- a/bin/ed/ed.h +++ b/bin/ed/ed.h @@ -115,7 +115,7 @@ if (--mutex == 0) { \ /* REALLOC: assure at least a minimum size for buffer b */ #define REALLOC(b,n,i,err) \ if ((i) > (n)) { \ - int ti = (n); \ + size_t ti = (n); \ char *ts; \ SPL1(); \ if ((b) != NULL) { \ @@ -141,7 +141,7 @@ if ((i) > (n)) { \ /* REALLOC: assure at least a minimum size for buffer b */ #define REALLOC(b,n,i,err) \ if ((i) > (n)) { \ - int ti = (n); \ + size_t ti = (n); \ char *ts; \ SPL1(); \ if ((ts = (char *) realloc((b), ti += max((i), MINBUFSZ))) == NULL) { \ |