init: Fix memory corruption when sanitizing platform paths
This commit fixes code that incorrectly increments s when it
hits the terminator character of the string being sanitized.
This means it will randomly start trashing memory beyond the
end of the string being sanitized until it happens to hit two
NULs (\0\0) which will break it out of the loop.
(cherry picked from commit 07f3fee164
)
Bug: 18885357
Change-Id: If6b01fe2b9bd5985f08f1278deb03b311d0170dc
This commit is contained in:
parent
4fca59181c
commit
ba95be58c5
|
@ -329,9 +329,9 @@ void sanitize(char *s)
|
|||
if (!s)
|
||||
return;
|
||||
|
||||
for (; *s; s++) {
|
||||
while (*s) {
|
||||
s += strspn(s, accept);
|
||||
if (*s) *s = '_';
|
||||
if (*s) *s++ = '_';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue