liuis / leveldb

Automatically exported from code.google.com/p/leveldb
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

unknown size of return string of leveldb_property_value() #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1. call leveldb_property_value() with "leveldb.stats"
2. strlen(leveldb_property_value("leveldb.stats"))

strlen doesn't find any '\0' terminator.
CopyString() is implemented as malloc(size) - memcpy().

Add size_t *size to leveldb_property_value() like leveldb_get() or return a 
real null-terminated string.

Original issue reported on code.google.com by theo.bertozzi on 20 Aug 2011 at 3:08

GoogleCodeExporter commented 9 years ago
I've attached a simple patch that solve the problem.
I differentiated the CopyString() function needed by leveldb_property_value() 
from the CopyData() function needed by leveldb_get(). (obviously one is null 
terminated the other is not)

Original comment by theo.bertozzi on 22 Aug 2011 at 2:10

Attachments:

GoogleCodeExporter commented 9 years ago
This is fixed in r49. Please verify.

Thanks Theo!

Original comment by ga...@google.com on 22 Aug 2011 at 9:10

GoogleCodeExporter commented 9 years ago
It work, great! 
Thanks

Original comment by theo.bertozzi on 22 Aug 2011 at 9:18

GoogleCodeExporter commented 9 years ago
Marking verified

Original comment by ga...@google.com on 22 Aug 2011 at 11:48