Coverity reports buffer size warning

Bug #1770113 reported by Anda Nicolae on 2018-05-09
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
R5.0
Fix Committed
Undecided
Anda Nicolae
Trunk
Fix Committed
Undecided
Anda 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.

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

OpenContrail Admin (ci-admin-f) wrote :

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

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

Jeba Paulaiyan (jebap) on 2018-05-10
tags: added: vrouter

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

OpenContrail Admin (ci-admin-f) wrote :

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

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

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>

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  Edit
Everyone can see this information.

Other bug subscribers