[Bug 258] New: scanf format not portable

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Tue May 28 01:05:01 EST 2002


http://bugzilla.mindrot.org/show_bug.cgi?id=258

           Summary: scanf format not portable
           Product: Portable OpenSSH
           Version: -current
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ssh
        AssignedTo: openssh-unix-dev at mindrot.org
        ReportedBy: liug at mama.indstate.edu


It seems the scanf format %[0-9] in Watcom doesn't work 
the same way as in gcc. Here is a note in the
Watcom C/C++ reference:

  Note:  A  dash  (-)  in  the  scanset  doesn't  indicate  a  range  of
   characters. For example, the string [0-9] matches the characters 0, -,
   and 9, not the characters 0 through 9.

I have to make the following change to make -R/-L option of ssh to work:

--- ssh.c.orig  Tue Apr 23 04:09:46 2002
+++ ssh.c       Sun May 26 19:48:49 2002
@@ -467,9 +467,9 @@
 
                case 'L':
                case 'R':
-                       if (sscanf(optarg, "%5[0-9]:%255[^:]:%5[0-9]",
+                       if (sscanf(optarg, "%5[0123456789]:%255[^:]:%5[012345678
9]",
                            sfwd_port, buf, sfwd_host_port) != 3 &&
-                           sscanf(optarg, "%5[0-9]/%255[^/]/%5[0-9]",
+                           sscanf(optarg, "%5[0123456789]/%255[^/]/%5[0123456789]",
                            sfwd_port, buf, sfwd_host_port) != 3) {
                                fprintf(stderr,
                                    "Bad forwarding specification '%s'\n",



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the openssh-unix-dev mailing list