Author: stefanct Date: Fri Sep 5 18:14:11 2014 New Revision: 1849 URL: http://flashrom.org/trac/flashrom/changeset/1849
Log: dmi.c: Duplicate returned strings because they are meant to be freed.
Without this patch dmi_shutdown calls free() on read-only strings.
Signed-off-by: Stefan Tauner stefan.tauner@alumni.tuwien.ac.at Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Modified: trunk/dmi.c
Modified: trunk/dmi.c ============================================================================== --- trunk/dmi.c Sun Aug 31 02:09:21 2014 (r1848) +++ trunk/dmi.c Fri Sep 5 18:14:11 2014 (r1849) @@ -120,18 +120,18 @@ size_t i, len;
if (string_id == 0) - return "Not Specified"; + return strdup("Not Specified");
while (string_id > 1 && string_id--) { if (buf >= limit) { msg_perr("DMI table is broken (string portion out of bounds)!\n"); - return "<OUT OF BOUNDS>"; + return strdup("<OUT OF BOUNDS>"); } buf += strnlen(buf, limit - buf) + 1; }
if (!*buf) /* as long as the current byte we're on isn't null */ - return "<BAD INDEX>"; + return strdup("<BAD INDEX>");
len = strnlen(buf, limit - buf); char *newbuf = malloc(len + 1);