Skip to content

Commit

Permalink
Fix warning of strncpy() size field.
Browse files Browse the repository at this point in the history
bcc/tests/cc/test_c_api.cc:159:10: warning: ‘char* strncpy(char*, const char*, size_t)’ specified bound 1024 equals destination size [-Wstringop-truncation]
  159 |   strncpy(libpath, lm->l_name, 1024);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
  • Loading branch information
Rtoax authored and yonghong-song committed May 21, 2022
1 parent cdcc86e commit 9105a1e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/cc/test_c_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static int mntns_func(void *arg) {
return -1;
}

strncpy(libpath, lm->l_name, 1024);
strncpy(libpath, lm->l_name, sizeof(libpath) - 1);
dlclose(dlhdl);
dlhdl = NULL;

Expand Down

0 comments on commit 9105a1e

Please sign in to comment.