Bug 1663 - dumplease not show end symbol at client hostname
Summary: dumplease not show end symbol at client hostname
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Networking (show other bugs)
Version: 1.16.x
Hardware: Other Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-29 21:09 UTC by Evgeniy Manachkin
Modified: 2010-05-18 21:33 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
patch to fix cut end symbol at hostname in udhcpd lease file (450 bytes, patch)
2010-04-30 15:16 UTC, Evgeniy Manachkin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Evgeniy Manachkin 2010-04-29 21:09:48 UTC
Im`m set hotname = 3M on client PC and up network.

dumpleases at router show only 3 in host name for this PC:

~ # dumpleases 
Mac Address IP Address Host Name Expires in 
00:19:21:92:4e:84 192.168.1.4 3 23:48:38

If set hostname for 3MM dumpleases show only 3M. Always cut end symbol at hostname string.
Comment 1 Evgeniy Manachkin 2010-04-30 14:33:50 UTC
Im`m copy lease file to PC and view in hexedit, hostname = hostname printed dumpleases. 

And dumpleases and in lease file client hostname dom`t include one symbol at end name.

Any ideas ? leases.c ? udhcpd.c ???
Comment 2 Evgeniy Manachkin 2010-04-30 15:13:56 UTC
This patch fix it:

--- leases.c.orig       2010-04-30 22:12:47.000000000 +0700                                                                   
+++ leases.c    2010-04-30 22:05:18.143207528 +0700                                                                           
@@ -66,7 +66,7 @@                                                                                                             
                        char *p;                                                                                              
                        if (hostname_len > sizeof(oldest->hostname))                                                          
                                hostname_len = sizeof(oldest->hostname);                                                      
-                       p = safe_strncpy(oldest->hostname, hostname, hostname_len);                                           
+                       p = safe_strncpy(oldest->hostname, hostname, hostname_len + 1);                                       
                        /* sanitization (s/non-ASCII/^/g) */                                                                  
                        while (*p) {                                                                                          
                                if (*p < ' ' || *p > 126)                                                                     
                                                                                   
Comment 3 Evgeniy Manachkin 2010-04-30 15:16:11 UTC
Created attachment 1609 [details]
patch to fix cut end symbol at hostname in udhcpd lease file
Comment 4 Denys Vlasenko 2010-05-02 12:12:42 UTC
what will happen if hostname_len == sizeof(oldest->hostname) ??
Comment 5 Evgeniy Manachkin 2010-05-02 13:16:01 UTC
(In reply to comment #4)
> what will happen if hostname_len == sizeof(oldest->hostname) ??

dumpleases show garbage (rt3052 mips LE) or segfault on dhcp client send hotsname (rtl8672 mips BE)
Comment 6 Denys Vlasenko 2010-05-02 18:32:46 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > what will happen if hostname_len == sizeof(oldest->hostname) ??

> dumpleases show garbage (rt3052 mips LE) or segfault on dhcp client send
> hotsname (rtl8672 mips BE)

Is it an answer to my question?
Comment 7 Denys Vlasenko 2010-05-18 21:33:29 UTC
Fix is here:

http://busybox.net/downloads/fixes-1.16.1/busybox-1.16.1-dhcpd.patch