summaryrefslogtreecommitdiff
path: root/ext/gdbm/gdbm.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/gdbm/gdbm.c')
-rw-r--r--ext/gdbm/gdbm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/gdbm/gdbm.c b/ext/gdbm/gdbm.c
index 1e76a28ca8..fba4d23866 100644
--- a/ext/gdbm/gdbm.c
+++ b/ext/gdbm/gdbm.c
@@ -169,7 +169,7 @@ rb_gdbm_fetch(dbm, key)
RSTRING(str)->len = val.dsize;
RSTRING(str)->orig = 0;
RSTRING(str)->ptr = REALLOC_N(val.dptr,char,val.dsize+1);
- RSTRING(str)->ptr[str->len] = '\0';
+ RSTRING(str)->ptr[val.dsize] = '\0';
OBJ_TAINT(str);
return (VALUE)str;