Print this page
OS-2444 richmond hardware maps need to support ivy bridge (review fixes)
@@ -68,17 +68,16 @@
if (input != NULL) {
/*
* Start scanning at beginning of input:
*/
scanstart = input;
- } else {
+ } else if (*lastp == NULL) {
/*
* If we have already finished scanning, return NULL.
*/
- if (*lastp == NULL)
return (NULL);
-
+ } else {
/*
* Otherwise, start scanning where we left off:
*/
scanstart = *lastp;
}
@@ -89,11 +88,13 @@
* We still have a separator, so advance the next-start
* pointer past it:
*/
*lastp = token + seplen;
/*
- * Copy out this element:
+ * Copy out this element. The buffer must fit the string
+ * exactly, so that topo_hdl_strfree() can determine its
+ * size with strlen().
*/
ret = topo_hdl_alloc(hdl, token - scanstart + 1);
(void) strncpy(ret, scanstart, token - scanstart);
ret[token - scanstart] = '\0';
} else {