[commit: ghc] master: Fix potential out-of-bound memory access (fa0cbd2)
git at git.haskell.org
git at git.haskell.org
Sun Apr 27 11:45:43 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/fa0cbd297ba12e02273efcaa5f52fe76e10b7126/ghc
>---------------------------------------------------------------
commit fa0cbd297ba12e02273efcaa5f52fe76e10b7126
Author: Nicolas Trangez <ikke at nicolast.be>
Date: Wed Apr 23 20:27:04 2014 +0200
Fix potential out-of-bound memory access
Issue discovered by Coverity scan, CID 43165.
Signed-off-by: Austin Seipp <austin at well-typed.com>
>---------------------------------------------------------------
fa0cbd297ba12e02273efcaa5f52fe76e10b7126
utils/hp2ps/HpFile.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/utils/hp2ps/HpFile.c b/utils/hp2ps/HpFile.c
index 86cbfb2..bdbf201 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';
More information about the ghc-commits
mailing list