summaryrefslogtreecommitdiff
path: root/utils/hp2ps
diff options
context:
space:
mode:
authorNicolas Trangez <ikke@nicolast.be>2014-04-23 20:27:04 +0200
committerAustin Seipp <austin@well-typed.com>2014-04-27 04:21:11 -0500
commitfa0cbd297ba12e02273efcaa5f52fe76e10b7126 (patch)
tree1d06ea64125ed99d4ce0ce5541f1578fd9a064e7 /utils/hp2ps
parentf2595fd9d03803874df792072292d792a2c03bce (diff)
downloadhaskell-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>
Diffstat (limited to 'utils/hp2ps')
-rw-r--r--utils/hp2ps/HpFile.c4
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';