The fix in commit
09a325a4de ("BUG/MINOR: tools: always terminate empty
lines") is insufficient. While it properly addresses the lack of trailing
zero, it doesn't account for it in the returned outlen that is used to
allocate a larger line. This happens at boot if the very first line of
the test file is exactly a sharp with nothing else. In this case it will
return a length 0 and the caller (parse_cfg()) will try to re-allocate an
entry of size zero and will fail, bailing out a lack of memory. This time
it should really be OK.
It doesn't need to be backported, unless the patch above would be.
goto leave;
}
leave:
- *nbargs = arg;
- *outlen = outpos;
-
/* make sure empty lines are terminated */
if (!arg)
EMIT_CHAR(0);
+ *nbargs = arg;
+ *outlen = outpos;
+
/* empty all trailing args by making them point to the trailing zero,
* at least the last one in any case.
*/