[MPlayer-dev-eng] url.c (maybe) 10l bug
Arpi
arpi at thot.banki.hu
Fri Feb 27 00:47:51 CET 2004
Hi,
while searching for URI encoding code for .so, i've found a possible
but at libmpdemux/url.c:225:
void
url_escape_string(char *outbuf, const char *inbuf) {
unsigned char c;
do {
c = *inbuf++;
if( (c >= 'A' && c <= 'Z') ||
(c >= 'a' && c <= 'z') ||
(c >= '0' && c <= '9') ||
(c >= 0x7f) ||
c=='-' || c=='_' || c=='.' || c=='!' || c=='~' ||
c=='*' || c=='\'' || c=='(' || c==')' || c=='%' ||
c==';' || c=='/' || c=='?' || c==':' || c=='@' ||
c=='&' || c=='=' || c=='+' || c=='$' || c==',' ||
c=='\0' ) {
*outbuf++ = c;
} else {
/* all others will be escaped */
unsigned char c1 = ((c & 0xf0) >> 4);
unsigned char c2 = (c & 0x0f);
if (c1 < 10) c1+='0';
else c1+='A'-10;
if (c2 < 10) c2+='0';
else c2+='A'-10;
*outbuf++ = '%';
*outbuf++ = c1;
*outbuf++ = c2;
}
} while (c != '\0');
the upper block accepts '%' as-is unescaped, but the lower block then
uses '%' to escape special chars. i guess that '%' should be escaped too...
or maybe the '%' is allowed here to let this function work on already
escaped URIs? it makes sence, but still has a buggy side-effect on
unescaped strings containing '%' char...
if no objection, Attila or Diego will commit a fix :))
A'rpi / Astral & ESP-team
--
Developer of MPlayer G2, the Movie Framework for all - http://www.MPlayerHQ.hu
More information about the MPlayer-dev-eng
mailing list