add some error checking to switch_url_encode function
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4188 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
712976653d
commit
c1cf282d39
|
@ -599,7 +599,16 @@ SWITCH_DECLARE(size_t) switch_url_encode(char *url, char *buf, size_t len)
|
||||||
const char urlunsafe[] = "\r\n \"#%&+:;<=>?@[\\]^`{|}";
|
const char urlunsafe[] = "\r\n \"#%&+:;<=>?@[\\]^`{|}";
|
||||||
const char hex[] = "0123456789ABCDEF";
|
const char hex[] = "0123456789ABCDEF";
|
||||||
|
|
||||||
|
if (!buf) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
memset(buf, 0, len);
|
memset(buf, 0, len);
|
||||||
|
|
||||||
|
if (!url) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
for( p = url ; *p ; p++) {
|
for( p = url ; *p ; p++) {
|
||||||
if (*p < ' ' || *p > '~' || strchr(urlunsafe, *p)) {
|
if (*p < ' ' || *p > '~' || strchr(urlunsafe, *p)) {
|
||||||
if ((x + 3) > len) {
|
if ((x + 3) > len) {
|
||||||
|
|
Loading…
Reference in New Issue