diff options
author | Nicolas Trangez <ikke@nicolast.be> | 2014-04-23 20:27:04 +0200 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2014-04-27 04:21:11 -0500 |
commit | fa0cbd297ba12e02273efcaa5f52fe76e10b7126 (patch) | |
tree | 1d06ea64125ed99d4ce0ce5541f1578fd9a064e7 | |
parent | f2595fd9d03803874df792072292d792a2c03bce (diff) | |
download | haskell-fa0cbd297ba12e02273efcaa5f52fe76e10b7126.tar.gz |
Fix potential out-of-bound memory access
Issue discovered by Coverity scan, CID 43165.
Signed-off-by: Austin Seipp <austin@well-typed.com>
-rw-r--r-- | utils/hp2ps/HpFile.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/utils/hp2ps/HpFile.c b/utils/hp2ps/HpFile.c index 86cbfb2049..bdbf201503 100644 --- a/utils/hp2ps/HpFile.c +++ b/utils/hp2ps/HpFile.c @@ -332,7 +332,7 @@ GetHpTok(FILE *infp) * "thefloatish"). */ -static char numberstring[ NUMBER_LENGTH - 1 ]; +static char numberstring[ NUMBER_LENGTH + 1 ]; token GetNumber(FILE *infp) @@ -350,7 +350,7 @@ GetNumber(FILE *infp) ch = getc(infp); } - ASSERT(i < NUMBER_LENGTH); /* did not overflow */ + ASSERT(i <= NUMBER_LENGTH); /* did not overflow */ numberstring[ i ] = '\0'; |