cc-wrapper: Resolve possible buffer overflow
buf needs to null-terminated line processing uses strcmp and regex. Thus, we should only read sizeof(buf) - 1 bytes to ensure we can null-terminate the buffer. Change-Id: I1f424b8097318eade58723818bfa154c3115d37e Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
This commit is contained in:
parent
c1bc6a5119
commit
ff156e05e3
@ -143,7 +143,7 @@ int main(int argc, char **argv)
|
||||
goto done;
|
||||
}
|
||||
|
||||
while ((len = read(pipes[0], buf, sizeof(buf))) > 0) {
|
||||
while ((len = read(pipes[0], buf, sizeof(buf) - 1)) > 0) {
|
||||
char *next = buf;
|
||||
|
||||
write(STDERR_FILENO, buf, len);
|
||||
|
Loading…
Reference in New Issue
Block a user