mcexec: fix strncat bounding

strncat must not look at the appendee's length, but at how much
is left where we're appending.
This API is stupid anyway, where is strlcat when we need it...

Change-Id: Icdf418083146420a06f8ba5ffdf882982610d39b
This commit is contained in:
Dominique Martinet
2018-10-25 10:27:40 +09:00
parent 03802052ed
commit 3a90521489

View File

@@ -3311,8 +3311,10 @@ int main_loop(struct thread_data_s *my_thread)
0);
break;
}
strncat(pathbuf, "/", 1);
strncat(pathbuf, tmpbuf, strlen(tmpbuf) + 1);
strncat(pathbuf, "/",
sizeof(pathbuf) - strlen(pathbuf) - 1);
strncat(pathbuf, tmpbuf,
sizeof(pathbuf) - strlen(pathbuf) - 1);
}
else {
}