fix compiling warning in pingUtil.cpp
* StarlingX devstack has switched Ubuntu Bionic. Default compiler is gcc 7.3.0. gcc 7.3.0 will report compiling error message "error: format not a string literal and no format arguments [-Werror=format-security]" for the calling of snprintf in pingUtil_send of pingUtil.cpp * gcc 4.8.5 doesn't report such warning. That's why current StarlingX building doesn't have such issue. Passed tests: * Fresh building * Deployment test * Unit tests, verified the change doesn't impact the code behavior. * System-level verification, mtcAgent and hwmond can start normally. Story: 2003161 Task: 29793 Change-Id: I21e84ac4b2c9deb8926c752fe79ea284a0d92b30 Signed-off-by: Yi Wang <yi.c.wang@intel.com>
This commit is contained in:
parent
506ef3fd7f
commit
9d837a4cc6
@ -204,7 +204,7 @@ int pingUtil_send ( ping_info_type & ping_info )
|
||||
ping4_tx.hdr.un.echo.id = htons(ping_info.identity) ;
|
||||
ping4_tx.hdr.un.echo.sequence = htons(ping_info.sequence) ;
|
||||
|
||||
snprintf ( &ping4_tx.msg[0], PING_MESSAGE_LEN, ping_info.message );
|
||||
snprintf ( &ping4_tx.msg[0], PING_MESSAGE_LEN, "%s", ping_info.message );
|
||||
|
||||
/* checksum should not be converted to htons
|
||||
* - will get (wrong icmp cksum ) */
|
||||
@ -226,7 +226,7 @@ int pingUtil_send ( ping_info_type & ping_info )
|
||||
ping6_tx.icmphdr.icmp6_id = htons(ping_info.identity) ;
|
||||
ping6_tx.icmphdr.icmp6_seq = htons(ping_info.sequence) ;
|
||||
|
||||
snprintf ( &ping6_tx.msg[0], PING_MESSAGE_LEN, ping_info.message );
|
||||
snprintf ( &ping6_tx.msg[0], PING_MESSAGE_LEN, "%s", ping_info.message );
|
||||
|
||||
ping6_tx.icmphdr.icmp6_cksum = htons(checksum(&ping6_tx, sizeof(ping6_tx)));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user