[svn:parrot] r40988 - trunk/src/dynpmc

cotto at svn.parrot.org cotto at svn.parrot.org
Sat Sep 5 06:39:09 UTC 2009


Author: cotto
Date: Sat Sep  5 06:39:06 2009
New Revision: 40988
URL: https://trac.parrot.org/parrot/changeset/40988

Log:
[string] avoid strstart abuse in gdbmhash, courtesy of the insomnic darbelo++

Modified:
   trunk/src/dynpmc/gdbmhash.pmc

Modified: trunk/src/dynpmc/gdbmhash.pmc
==============================================================================
--- trunk/src/dynpmc/gdbmhash.pmc	Sat Sep  5 02:26:41 2009	(r40987)
+++ trunk/src/dynpmc/gdbmhash.pmc	Sat Sep  5 06:39:06 2009	(r40988)
@@ -250,11 +250,12 @@
 
         keystr         = make_hash_key(interp, key);
 
-        key_gdbm.dsize = keystr->strlen;
-        key_gdbm.dptr  = keystr->strstart;
+        key_gdbm.dptr  = Parrot_str_to_cstring(interp, keystr);
+        key_gdbm.dsize = strlen(key_gdbm.dptr);
         val_gdbm       = gdbm_fetch(dbf, key_gdbm);
 
         val = Parrot_str_new(interp, val_gdbm.dptr, val_gdbm.dsize);
+        Parrot_str_free_cstring(key_gdbm.dptr);
         free(val_gdbm.dptr);
 
         return val;


More information about the parrot-commits mailing list