Coverity reports buffer size warning

Bug #1770113 reported by Anda-Maria Nicolae
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
R5.0
Fix Committed
Undecided
Anda-Maria Nicolae
Trunk
Fix Committed
Undecided
Anda-Maria Nicolae
OpenContrail
New
Undecided
Unassigned

Bug Description

Hi all,

I have run Coverity on branch R5.0 and it reported the following issue on file pkt0_interface.cc:
buffer_size_warning: Calling strncpy with a maximum size argument of 16 bytes on destination array ifr.ifr_name of size 16 bytes might leave the destination string unterminated.
The offending line is:
strncpy(ifr.ifr_name, name_.data(), IF_NAMESIZE);
which appears 3 times in pkt0_interface.cc.

I've noticed that in several parts of code, name_.c_str() is used, which is guaranteed to be a NULL-terminated string.

Tags: vrouter
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R5.0

Review in progress for https://review.opencontrail.org/42886
Submitter: Anda Nicolae (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/42887
Submitter: Anda Nicolae (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/42892
Submitter: Anda Nicolae (<email address hidden>)

Jeba Paulaiyan (jebap)
tags: added: vrouter
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R5.0

Review in progress for https://review.opencontrail.org/43519
Submitter: Anda Nicolae (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Review in progress for https://review.opencontrail.org/42887
Submitter: Anda Nicolae (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/42892
Submitter: Anda Nicolae (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/42892
Committed: http://github.com/Juniper/contrail-controller/commit/d8f42c56e0046ea8e2b8ce03ae0a376ba8f3c481
Submitter: Zuul v3 CI (<email address hidden>)
Branch: master

commit d8f42c56e0046ea8e2b8ce03ae0a376ba8f3c481
Author: Anda Nicolae <email address hidden>
Date: Wed May 9 12:55:54 2018 +0300

Coverity issues in pkt0_interface.cc

buffer_size_warning: Calling strncpy with a maximum size argument of 16 bytes
on destination array ifr.ifr_name of size 16 bytes might leave the destination
string unterminated.

Change-Id: I01a7f2cf67a20a79e1e29e0f6497d523186387ce
Closes-Bug: #1770113
Signed-off-by: Anda Nicolae <email address hidden>

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote :

Reviewed: https://review.opencontrail.org/42887
Committed: http://github.com/Juniper/contrail-controller/commit/901848474a495277c44f6c98a5de345c52d14fe1
Submitter: Zuul v3 CI (<email address hidden>)
Branch: R5.0

commit 901848474a495277c44f6c98a5de345c52d14fe1
Author: Anda Nicolae <email address hidden>
Date: Wed May 9 12:55:54 2018 +0300

Coverity issues in pkt0_interface.cc

buffer_size_warning: Calling strncpy with a maximum size argument of 16 bytes
on destination array ifr.ifr_name of size 16 bytes might leave the destination
string unterminated.

Change-Id: I01a7f2cf67a20a79e1e29e0f6497d523186387ce
Closes-Bug: #1770113
Signed-off-by: Anda Nicolae <email address hidden>

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.