Skip to content

sizeof('c')=4, not 1: fix overly-pessimistic IB_INSUFFICIENT_MEMORY return #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libopensm/osm_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ static ib_api_status_t dbg_do_line(IN char **pp_local, IN uint32_t buf_size,
sprintf(line, "%s%s", p_prefix_str, p_new_str);
len = (uint32_t) strlen(line);
*p_total_len += len;
if (*p_total_len + sizeof('\0') > buf_size)
if (*p_total_len + 1 /* NUL */ > buf_size)
return IB_INSUFFICIENT_MEMORY;

strcpy(*pp_local, line);
Expand Down