Skip to content

Commit

Permalink
SCP: Another Random Act of Memory (Sanitization)
Browse files Browse the repository at this point in the history
Clang's memory sanitizer found an off-by-one bug in sim_addr_acl_check
while executing "testlib".
  • Loading branch information
bscottm committed Dec 1, 2023
1 parent d235afe commit cf27dda
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sim_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ if (c != NULL) {
if ((c - validate_addr) > sizeof (v_cpy) - 1)
return status;
memcpy (v_cpy, validate_addr, c - validate_addr); /* Copy everything before the / */
v_cpy[1 + c - validate_addr] = '\0'; /* NUL terminate the result */
v_cpy[c - validate_addr] = '\0'; /* NUL terminate the result */
validate_addr = v_cpy; /* Use the original string minus the prefix specifier */
}
if (p_getaddrinfo(validate_addr, NULL, NULL, &ai_validate))
Expand Down

0 comments on commit cf27dda

Please sign in to comment.