diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-03-02 01:05:15 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-03-02 07:48:38 +0100 |
commit | a075e3aa52da7575f3c62e80712cea7a603aa18c (patch) | |
tree | 9cf953c0f4df8d46ceb2cdd741255eb45957e48f | |
parent | ff3b1f48605dbe0c051415e1d0e1da2b9c44275c (diff) | |
download | curl-bagder/formget-simplified.tar.gz |
curl_formget: simplifybagder/formget-simplified
Should also address the Coverity warning CID 1460457, which by all means
look like a false positive; complaining on the case (size_t)-1.
Follow-up to 87869e38d
-rw-r--r-- | lib/formdata.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/formdata.c b/lib/formdata.c index 6103959cd..17f474487 100644 --- a/lib/formdata.c +++ b/lib/formdata.c @@ -728,19 +728,14 @@ int curl_formget(struct curl_httppost *form, void *arg, if(!nread) break; - switch(nread) { - default: - if(append(arg, buffer, nread) == nread) - break; - /* FALLTHROUGH */ - case CURL_READFUNC_ABORT: + if((nread <= sizeof(buffer) && + (append(arg, buffer, nread) == nread))) + ; + /* anything else is an error */ + else if(nread == CURL_READFUNC_ABORT) result = CURLE_ABORTED_BY_CALLBACK; - break; - case (size_t) -1: /* Read error. */ - case CURL_READFUNC_PAUSE: /* Should not be paused. */ + else result = CURLE_READ_ERROR; - break; - } } Curl_mime_cleanpart(&toppart); |