aboutsummaryrefslogtreecommitdiffstats
path: root/b.c
diff options
context:
space:
mode:
authorTodd C. Miller <Todd.Miller@sudo.ws>2020-07-29 12:27:45 -0600
committerGitHub <noreply@github.com>2020-07-29 21:27:45 +0300
commit22ee26b925f0c93b3539efd2e195af74bdf34fac (patch)
tree706f086d88774839fc2bbe527b86db3063b98076 /b.c
parentb82b649aa65fbdff45869d1fd6d72fd2b85946cd (diff)
downloadplatform_external_one-true-awk-22ee26b925f0c93b3539efd2e195af74bdf34fac.tar.gz
platform_external_one-true-awk-22ee26b925f0c93b3539efd2e195af74bdf34fac.tar.bz2
platform_external_one-true-awk-22ee26b925f0c93b3539efd2e195af74bdf34fac.zip
Cast to uschar when storing a char in an int that will be used as an index (#88)
* Cast to uschar when storing a char in an int that will be used as an index. Fixes a heap underflow when the input char has the high bit set and FS is a regex. * Add regress test for underflow when RS is a regex and input is 8-bit.
Diffstat (limited to 'b.c')
-rw-r--r--b.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/b.c b/b.c
index c167b50..a338d43 100644
--- a/b.c
+++ b/b.c
@@ -684,7 +684,7 @@ bool fnematch(fa *pfa, FILE *f, char **pbuf, int *pbufsize, int quantum)
FATAL("stream '%.30s...' too long", buf);
buf[k++] = (c = getc(f)) != EOF ? c : 0;
}
- c = buf[j];
+ c = (uschar)buf[j];
/* assert(c < NCHARS); */
if ((ns = pfa->gototab[s][c]) != 0)