Null-terminate binary strings

See oss-fuzz/28779
This commit is contained in:
Evan Miller
2020-12-18 09:26:28 -05:00
parent c46c8b0e4d
commit a1cda27a58

View File

@@ -1001,8 +1001,9 @@ char *mdb_col_to_string(MdbHandle *mdb, void *buf, int start, int datatype, int
if (size<0) { if (size<0) {
text = g_strdup(""); text = g_strdup("");
} else { } else {
text = g_malloc(size); text = g_malloc(size+1);
memcpy(text, (char*)buf+start, size); memcpy(text, (char*)buf+start, size);
text[size] = '\0';
} }
break; break;
case MDB_TEXT: case MDB_TEXT: