70ff4d044ece208804922cd5e69e439c7fb87dff jcasper Mon Nov 23 08:43:33 2015 -0800 Making buf size into #def, upsizing another buffer, refs #16406 diff --git src/lib/net.c src/lib/net.c index 00a652f..1a37d50 100644 --- src/lib/net.c +++ src/lib/net.c @@ -437,31 +437,31 @@ *rangeEnd = atoll(z); } } } } void netParseUrl(char *url, struct netParsedUrl *parsed) /* Parse a URL into components. A full URL is made up as so: * http://user:password@hostName:port/file;byterange=0-499 * User and password may be cgi-encoded. * This is set up so that the http:// and the port are optional. */ { char *s, *t, *u, *v, *w; -char buf[4096]; +char buf[MAXURLSIZE]; /* Make local copy of URL. */ if (strlen(url) >= sizeof(buf)) errAbort("Url too long: '%s'", url); strcpy(buf, url); url = buf; /* Find out protocol - default to http. */ s = trimSpaces(url); s = stringIn("://", url); if (s == NULL) { strcpy(parsed->protocol, "http"); s = url; } @@ -1234,31 +1234,31 @@ int netUrlHead(char *url, struct hash *hash) /* Go get head and return status. Return negative number if * can't get head. If hash is non-null, fill it with header * lines with upper cased keywords for case-insensitive lookup, * including hopefully CONTENT-TYPE: . */ { return netUrlHeadExt(url, "HEAD", hash); } long long netUrlSizeByRangeResponse(char *url) /* Use byteRange as a work-around alternate method to get file size (content-length). * Return negative number if can't get. */ { long long retVal = -1; -char rangeUrl[2048]; +char rangeUrl[MAXURLSIZE]; safef(rangeUrl, sizeof(rangeUrl), "%s;byterange=0-0", url); struct hash *hash = newHash(0); int status = netUrlHeadExt(rangeUrl, "GET", hash); if (status == 206) { char *rangeString = hashFindValUpperCase(hash, "Content-Range:"); if (rangeString) { /* input pattern: Content-Range: bytes 0-99/2738262 */ char *slash = strchr(rangeString,'/'); if (slash) { retVal = atoll(slash+1); } }