Bug 1226400 - nwfilter_dhcpsnoop.c:1962: 2 * off by one error ?
Summary: nwfilter_dhcpsnoop.c:1962: 2 * off by one error ?
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Erik Skultety
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-05-29 16:25 UTC by David Binderman
Modified: 2015-06-02 12:08 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-06-02 12:08:56 UTC
Embargoed:


Attachments (Terms of Use)

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


Note You need to log in before you can comment on or make changes to this bug.