Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

don't hardcode the buffer length of url_escape #50

Closed
wants to merge 1 commit into from

2 participants

@gtmanfred

stub

@falconindy
Owner

Going with a larger static buffer instead, since URLs can only reasonably be so long.

stub a dub

@falconindy falconindy closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 7, 2013
  1. @gtmanfred
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 1 deletion.
  1. +6 −1 cower.c
View
7 cower.c
@@ -2324,12 +2324,17 @@ void *thread_pool(void *arg) /* {{{ */
static char *url_escape(char *in, int len, const char *delim) /* {{{ */
{
char *tok, *escaped;
- char buf[128] = { 0 };
+ char *buf = malloc(strlen(in) * 3);
+ buf[0] = 0;
if(!delim) {
return curl_easy_escape(NULL, in, len);
}
+ if( buf == NULL) {
+ return NULL;
+ }
+
while((tok = strsep(&in, delim))) {
escaped = curl_easy_escape(NULL, tok, 0);
strcat(buf, escaped);
Something went wrong with that request. Please try again.