NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/50908: src/sbin/fsck_msdos/dir.c:988: clumsy call to memset ?



>Number:         50908
>Category:       bin
>Synopsis:       src/sbin/fsck_msdos/dir.c:988: clumsy call to memset ?
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 07 12:15:00 +0000 2016
>Originator:     David Binderman
>Release:        cvs dated 20160305
>Organization:
>Environment:
>Description:

[src/sbin/fsck_msdos/dir.c:988] -> [src/sbin/fsck_msdos/dir.c:989]: (performance) Buffer 'p' is being written before its old content has been used.
[src/sbin/fsck_msdos/dir.c:988] -> [src/sbin/fsck_msdos/dir.c:990]: (performance) Buffer 'p' is being written before its old content has been used.


Source code is

    memset(p, 0, 32);
    memset(p, ' ', 11);
    memcpy(p, d.name, strlen(d.name));


Maybe better code

    memset(p + 11, 0, 32 - 11);
    memset(p, ' ', 11);
    memcpy(p, d.name, strlen(d.name));



>How-To-Repeat:

>Fix:



Home | Main Index | Thread Index | Old Index