mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-05 00:35:23 +00:00
cr-service: fix coverity STRING_OVERFLOW
criu-3.12/criu/cr-service.c:1305: fixed_size_dest: You might overrun the 108-character fixed-size string "server_addr.sun_path" by copying "opts.addr" without checking the length. Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
committed by
Andrei Vagin
parent
c189a9bbf2
commit
defbd43351
@@ -1302,7 +1302,8 @@ int cr_service(bool daemon_mode)
|
||||
SET_CHAR_OPTS(addr, CR_DEFAULT_SERVICE_ADDRESS);
|
||||
}
|
||||
|
||||
strcpy(server_addr.sun_path, opts.addr);
|
||||
strncpy(server_addr.sun_path, opts.addr,
|
||||
sizeof(server_addr.sun_path) - 1);
|
||||
|
||||
server_addr_len = strlen(server_addr.sun_path)
|
||||
+ sizeof(server_addr.sun_family);
|
||||
|
Reference in New Issue
Block a user