"String not null terminated" issues reported by static analysis in Stx-metal
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
StarlingX |
Fix Released
|
High
|
chen haochuan |
Bug Description
Title
-----
There is "String not null terminated" issue reported by static analysis in "stx-metal"
Brief Description
-----------------
stx/stx-
function:
int rmon_service_inbox ( int clients )
line#525
bytes = recvfrom( rmon_sock.
if ( bytes > 0 )
{
Comment:
in bytes > 0 branch, propose add buf[RMON_MAX_LEN-1] = '\0';
stx/stx-
function:
int active_
line#212
rc = recvfrom ( amon.rx_sock, amon.rx_buf, AMON_MAX_LEN, 0,
propose add amon.rx_
stx/stx-
function:
int mtc_service_inbox ( nodeLinkClass * obj_ptr,
line#130 --- line#145
if ( iface == INFRA_INTERFACE )
{
if ( ( obj_ptr ) &&
( obj_ptr-
( sock_ptr-
{
bytes = sock_ptr-
}
else
{
return ( FAIL_NO_INFRA_PROV );
}
}
else
{
bytes = sock_ptr-
}
add msg.buf[BUF_SIZE-1] = '\0'
stx/stx-
int hwmon_service_inbox ( void )
line#227 --- line#230
memset ((void*
bytes = hwmon_sock.
if( bytes <= 0 )
{
if ( ( errno == EINTR ) || ( errno == EAGAIN ))
{
return (RETRY);
}
else
{
elog ("receive error (%d:%s)\n", errno , strerror (errno));
return (FAIL_TO_RECEIVE);
}
}
msg.buf[BUF_SIZE-1] = '\0'
stx/stx-
int hostw_service_
line#175 --- line#180
mtc_message_type msg[2]; /* we use a chunk of memory larger than a single
int len = sizeof(msg[0]) + 1;
add
memset(&msg, 0, 2*sizeof(msg[0]));
Severity
--------
Critical: there is possibility of string malfunction
Steps to Reproduce
------------------
Run code static analysis tool
Expected Behavior
------------------
no risk of string malfunction
Reproducibility
---------------
Always
System Configuration
-------
All case
tags: | added: stx.security |
information type: | Public → Private |
information type: | Private → Private Security |
Changed in starlingx: | |
status: | New → In Progress |
Changed in starlingx: | |
importance: | Undecided → High |
assignee: | nobody → Cindy Xie (xxie1) |
Changed in starlingx: | |
assignee: | Cindy Xie (xxie1) → haitao wang (hwang85) |
description: | updated |
Changed in starlingx: | |
assignee: | haitao wang (hwang85) → chen haochuan (martin1982) |
Changed in starlingx: | |
status: | In Progress → Fix Committed |
status: | Fix Committed → Fix Released |
tags: | added: stx.2019.03 |
information type: | Private Security → Public Security |
tags: |
added: stx.2019.05 removed: stx.2019.03 |
tags: |
added: stx.2.0 removed: stx.2019.05 |
https:/ /review. openstack. org/#/c/ 615478/