dorigom / yaffs2utils

Automatically exported from code.google.com/p/yaffs2utils
GNU General Public License v2.0
4 stars 11 forks source link

a typo that could likely cause a segmentation file #42

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The latest trunk version contains the following line in unyaffs2
===
static int
unyaffs2_extract_hardlink (const char *fpath, struct unyaffs2_obj *obj)
{
[...]
union unyaffs2_file_variant *variant;
[...]
memcpy(&variant, &obj->variant, sizeof(obj->variant));
===

Since variant is an uninitialised pointer to a structure, memcpy() will try to 
write to a random location.  A quick fix would be to define variant as a static 
variable (i.e. remove '*'), or you need to initialise the variable before using 
it :)

Original issue reported on code.google.com by dmi...@khlebnikov.net on 13 Apr 2013 at 3:02