dmi: fix more pointer subtraction bugs
authorH. Peter Anvin <hpa@linux.intel.com>
Wed, 27 Apr 2011 00:36:37 +0000 (17:36 -0700)
committerH. Peter Anvin <hpa@linux.intel.com>
Wed, 27 Apr 2011 00:36:37 +0000 (17:36 -0700)
Two more places with bogus pointer subtraction...

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
core/dmi.c

index 988a4e8..e4deb15 100644 (file)
@@ -283,13 +283,13 @@ static const char *dmi_install_string(const char *pfx, const char *str)
     }
 
     pfxlen = strlen(pfx);
-    q = nstr = malloc(pfxlen + (ep-p) + 1);
+    q = nstr = malloc(pfxlen + (ep-str) + 1);
     if (!nstr)
        return NULL;
     memcpy(q, pfx, pfxlen);
     q += pfxlen;
     memcpy(q, str, ep-str);
-    q += (ep-p);
+    q += (ep-str);
     *q = '\0';
 
     return nstr;