Skip to content

Commit b5f14a3

Browse files
committed
fix unchecked return values from libcurl calls
- fail on memory problems with the URL API - mark an snmprintf call as (void) Detected by Coverity
1 parent 2f38b45 commit b5f14a3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

trurl.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,9 +1489,10 @@ static void singleurl(struct option *o,
14891489
wlen = strlen(w);
14901490
iinfo->ptr = NULL;
14911491
}
1492-
curl_msnprintf(iterbuf, sizeof(iterbuf), "%.*s%s=%.*s", (int)plen, part,
1493-
urlencode ? "" : ":",
1494-
(int)wlen, w);
1492+
(void)curl_msnprintf(iterbuf, sizeof(iterbuf),
1493+
"%.*s%s=%.*s", (int)plen, part,
1494+
urlencode ? "" : ":",
1495+
(int)wlen, w);
14951496
setone(uh, iterbuf, o);
14961497
if(iter->next) {
14971498
struct iterinfo info;
@@ -1510,7 +1511,8 @@ static void singleurl(struct option *o,
15101511
char *npath;
15111512
size_t olen;
15121513
/* extract the current path */
1513-
curl_url_get(uh, CURLUPART_PATH, &opath, 0);
1514+
if(curl_url_get(uh, CURLUPART_PATH, &opath, 0))
1515+
errorf(o, ERROR_ITER, "out of memory");
15141516

15151517
/* does the existing path end with a slash, then don't
15161518
add one in between */
@@ -1522,7 +1524,8 @@ static void singleurl(struct option *o,
15221524
apath);
15231525
if(npath) {
15241526
/* set the new path */
1525-
curl_url_set(uh, CURLUPART_PATH, npath, 0);
1527+
if(curl_url_set(uh, CURLUPART_PATH, npath, 0))
1528+
errorf(o, ERROR_ITER, "out of memory");
15261529
}
15271530
curl_free(npath);
15281531
curl_free(opath);

0 commit comments

Comments
 (0)