Bug 1757 - strdelim has a bug caused only one user with quote
Summary: strdelim has a bug caused only one user with quote
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: Miscellaneous (show other bugs)
Version: 5.4p1
Hardware: Other Linux
: P2 normal
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_5_6
  Show dependency treegraph
 
Reported: 2010-04-15 20:23 AEST by Bitman Zhou
Modified: 2011-01-24 12:33 AEDT (History)
1 user (show)

See Also:


Attachments
/home/djm/misc-strdelim-quote.diff (434 bytes, patch)
2010-07-02 14:23 AEST, Damien Miller
dtucker: ok+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bitman Zhou 2010-04-15 20:23:46 AEST
openssh-5.4p1/misc.c

154 /* Characters considered whitespace in strsep calls. */
155 #define WHITESPACE " \t\r\n"
156 #define QUOTE   "\""
157 
158 /* return next token in configuration line */
159 char *
160 strdelim(char **s)
161 {
...
179         } else {
180             *s[0] = '\0';
181             return (old);
182         }
...


It should be:

        } else {
            *s[0] = '\0';
            *s += strspn(*s + 1, WHITESPACE) + 1;
            return (old);
        }
Comment 1 Damien Miller 2010-06-25 21:32:25 AEST
Thanks for the report. Could you give an example of the bug? E.g. a testcase of what this code does wrong.
Comment 2 Bitman Zhou 2010-06-28 14:33:51 AEST
To reproduce this bug, set AllowUsers to something like:

> "user name 1" "user name 2"
user name 2 won't be allowed to login

> "user name a" userb
userb won't be allowed to login

Thanks.
Comment 3 Damien Miller 2010-07-02 14:23:27 AEST
Created attachment 1893 [details]
/home/djm/misc-strdelim-quote.diff

Patch version of proposed fix
Comment 4 Damien Miller 2010-07-02 14:32:57 AEST
patch applied, this will be in OpenSSH 5.6. Thanks.
Comment 5 Damien Miller 2011-01-24 12:33:54 AEDT
Move resolved bugs to CLOSED after 5.7 release