[BusyBox 0001072]: "nc" can't work any more (with patched)

bugs at busybox.net bugs at busybox.net
Mon Oct 16 01:16:19 UTC 2006


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=1072 
====================================================================== 
Reported By:                rockeychu
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   1072
Category:                   Networking Support
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             10-13-2006 03:54 PDT
Last Modified:              10-15-2006 18:16 PDT
====================================================================== 
Summary:                    "nc" can't work any more (with patched)
Description: 
nc can't work cause of defined incorrect type of 'opt', patched as
following:

Index: networking/nc.c
===================================================================
--- networking/nc.c     (revision 16376)
+++ networking/nc.c     (working copy)
@@ -17,7 +17,7 @@
 int nc_main(int argc, char **argv)
 {
        int sfd = 0, cfd;
-       unsigned opt;
+       int opt;
        unsigned lport = 0, wsecs = 0, delay = 0;
        unsigned do_listen = 0, execflag = 0;
        struct sockaddr_in address;

====================================================================== 

---------------------------------------------------------------------- 
 vda - 10-15-06 13:48  
---------------------------------------------------------------------- 
Care to explain? At least explain what kind of error you get... 

---------------------------------------------------------------------- 
 rockeychu - 10-15-06 18:16  
---------------------------------------------------------------------- 
Sorry for my carelessness&http://busybox.net/bugs/view.php?id=12290;

If without this patch, nc can't do any thing, such as:

   nc 192.168.0.1 23
   nc -l -p 8000
   ...

they all show usages only. The reason is:

getopt() will reutrn a "int" result (shall return -1 when all command line
options are parsed.), but revision 16376 assigned it as "usigned opt", so
-1 will be treat as positive number and always greater than 0. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
10-13-06 03:54  rockeychu      New Issue                                    
10-13-06 03:54  rockeychu      Status                   new => assigned     
10-13-06 03:54  rockeychu      Assigned To               => BusyBox         
10-15-06 13:48  vda            Note Added: 0001705                          
10-15-06 18:16  rockeychu      Note Added: 0001706                          
======================================================================




More information about the busybox-cvs mailing list