radareorg / sdb

Simple and fast string based key-value database with support for arrays and json
https://www.radare.org/
MIT License
218 stars 62 forks source link

sdb unchecked malloc array.c #105

Closed VisualPrankDude closed 8 years ago

VisualPrankDude commented 8 years ago
 <zlul_> is sdb_array_get safe ?
 ./shlr/sdb/src/array.c
97                 o = malloc (len + 1);
98                 memcpy (o, str, len);
99                 o[len] = 0;

<zlul> wait, I confused unchecked malloc with 0 termnination
<NighterMan> yes, in case of failed malloc you would end up trying to write to 0x0
<NighterMan> so you will get a segfault
radare commented 8 years ago

thanks! its all fixed now

On 06 Jul 2016, at 03:03, VisualPrankDude notifications@github.com wrote:

is sdb_array_get safe ? ./shlr/sdb/src/array.c 97 o = malloc (len + 1); 98 memcpy (o, str, len); 99 o[len] = 0; wait, I confused unchecked malloc with 0 termnination yes, in case of failed malloc you would end up trying to write to 0x0 so you will get a segfault — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/radare/sdb/issues/105, or mute the thread https://github.com/notifications/unsubscribe/AA3-lhvxVTyJaeX_fhJZabKEw2iOJDjrks5qSv76gaJpZM4JFqow.
radare commented 8 years ago

fixed in master