Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/63e49e1331b6c5af5032b834d8cadf9ea0cbaedb

>---------------------------------------------------------------

commit 63e49e1331b6c5af5032b834d8cadf9ea0cbaedb
Author: Simon Marlow <[email protected]>
Date:   Wed Nov 30 15:25:57 2011 +0000

    Fix potential crash on Windows: off-by-one in malloc()
    
    Spotted by gdb's malloc debugger while I was looking for something else.

>---------------------------------------------------------------

 rts/Linker.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/rts/Linker.c b/rts/Linker.c
index 1ba0260..96a0741 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -2817,7 +2817,7 @@ cstring_from_section_name (UChar* name, UChar* strtab)
         int strtab_offset = strtol((char*)name+1,NULL,10);
         int len = strlen(((char*)strtab) + strtab_offset);
 
-        newstr = stgMallocBytes(len, "cstring_from_section_symbol_name");
+        newstr = stgMallocBytes(len+1, "cstring_from_section_symbol_name");
         strcpy((char*)newstr, (char*)((UChar*)strtab) + strtab_offset);
         return newstr;
     }



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to