[Bug 1777] New: UDHCP server has a bug

bugzilla at busybox.net bugzilla at busybox.net
Fri May 14 08:36:50 UTC 2010


https://bugs.busybox.net/show_bug.cgi?id=1777

           Summary: UDHCP server has a bug
           Product: Busybox
           Version: 1.16.x
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P5
         Component: Networking
        AssignedTo: unassigned at busybox.net
        ReportedBy: yhniejun at gmail.com
                CC: busybox-cvs at busybox.net
   Estimated Hours: 0.0


The udhcpd has a bug of getting dhcp client's hostname. For example, My
hostname is 'niejun', bug the udhcpd get the hostname is 'nieju'. And I find
the '/var/lib/misc/udhcpd.leases' file also has the hostname 'nieju'.

The leater, I see the source of udhcpd. I find in the file
"networking/udhcp/leases.c", at line 69,
    p = safe_strncpy(oldest->hostname, hostname, hostname_len);

The function of 'safe_strncpy' has a bug. 

char* FAST_FUNC safe_strncpy(char *dst, const char *src, size_t size)
{
    if (!size) return dst;
    dst[--size] = '\0';
    return strncpy(dst, src, size);
}

Such as:
char* FAST_FUNC safe_strncpy(char *dst, const char *src, size_t size)
{
    if (!size) return dst;
    dst[size-1] = '\0';
    return strncpy(dst, src, size);
}

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list