udhcpc: fix a problem with binary-encoded options
authorDenys Vlasenko <vda.linux@googlemail.com>
Sun, 6 Feb 2011 17:00:58 +0000 (18:00 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 6 Feb 2011 17:00:58 +0000 (18:00 +0100)
function                                             old     new   delta
attach_option                                        395     413     +18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/udhcp/common.c

index 311f79e7e29a9f8258b7116c05a18a90395cf311..0a60261aba513fbd04e99dae1417b6854f242244 100644 (file)
@@ -375,7 +375,7 @@ static NOINLINE void attach_option(
                new->data = xmalloc(length + OPT_DATA);
                new->data[OPT_CODE] = optflag->code;
                new->data[OPT_LEN] = length;
-               memcpy(new->data + OPT_DATA, buffer, length);
+               memcpy(new->data + OPT_DATA, (allocated ? allocated : buffer), length);
 
                curr = opt_list;
                while (*curr && (*curr)->data[OPT_CODE] < optflag->code)