Bug 1226400

Summary: nwfilter_dhcpsnoop.c:1962: 2 * off by one error ?
Product: [Community] Virtualization Tools Reporter: David Binderman <dcb314>
Component: libvirtAssignee: Erik Skultety <eskultet>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: eskultet, rbalakri
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-02 12:08:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Binderman 2015-05-29 16:25:31 UTC
Description of problem:

[nwfilter/nwfilter_dhcpsnoop.c:1962]: (error) Width 16 given in format string (no. 3) is larger than destination buffer 'ipstr[16]', use %15s to prevent overflowing it.

[nwfilter/nwfilter_dhcpsnoop.c:1962]: (error) Width 16 given in format string (no. 4) is larger than destination buffer 'srvstr[16]', use %15s to prevent overflowing it.

Source code is

        if (sscanf(line, "%u %55s %16s %16s", &ipl.timeout,
                   ifkey, ipstr, srvstr) < 4) {




Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Erik Skultety 2015-06-02 12:02:55 UTC
Fixed in:

commit 152e315433f2ff69a5e91a2269812918da2ce091
Author: Erik Skultety <eskultet>
Date:   Tue Jun 2 09:25:04 2015 +0200

    nwfilter: Fix sscanf off-by-one error in virNWFilterSnoopLeaseFileLoad
    
    We allocate 16 bytes for IPv4 address and 55 bytes for interface
    key, therefore we should read up to 15/54 bytes and let the last byte
    reserved for terminating null byte in sscanf.

v1.2.16-11-g152e315