]> git.pond.sub.org Git - empserver/commitdiff
Fix client redirection and execute for non-ASCII characters
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 2 Jul 2011 15:17:53 +0000 (17:17 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 9 Jul 2011 13:16:21 +0000 (15:16 +0200)
The client rejects unauthorized redirection and execute.  Its
authorized check always fails for arguments with non-ASCII characters.
The culprit is ring_search(): It compares plain char to unsigned char,
which breaks when char is signed.  Believed to be broken in commit
8b7d0b91, v4.3.11.

Note that non-ASCII characters only work in UTF-8 sessions.  In ASCII
sessions, the server replaces them, and the authorized check fails.
Works as designed.

src/client/ringbuf.c

index f26e712f5e2054376908a161d9e5897c82031f09..a27615ac540bd9167a4da218a32417584f14b6ac 100644 (file)
@@ -159,7 +159,8 @@ ring_search(struct ring *r, char *s)
     size_t i, j;
 
     for (i = r->cons; i + len <= r->prod; i++) {
-       for (j = 0; j < len && s[j] == r->buf[(i + j) % RING_SIZE]; j++) ;
+       for (j = 0; s[j] && s[j] == (char)r->buf[(i + j) % RING_SIZE]; j++)
+           ;
        if (!s[j])
            return i - r->cons;
     }