[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 250/282: pause: bail out on bad input
From: |
gnunet |
Subject: |
[gnurl] 250/282: pause: bail out on bad input |
Date: |
Wed, 01 Apr 2020 14:31:55 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit e54b1885d19dee5ed04761295020a0a84b8296ca
Author: Daniel Stenberg <address@hidden>
AuthorDate: Fri Mar 6 10:12:22 2020 +0100
pause: bail out on bad input
A NULL easy handle or an easy handle without an associated connection
cannot be paused or unpaused.
Closes #5050
---
lib/easy.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/lib/easy.c b/lib/easy.c
index 2446557f4..33bc1aab7 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -973,15 +973,21 @@ void curl_easy_reset(struct Curl_easy *data)
*/
CURLcode curl_easy_pause(struct Curl_easy *data, int action)
{
- struct SingleRequest *k = &data->req;
+ struct SingleRequest *k;
CURLcode result = CURLE_OK;
- int oldstate = k->keepon & (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE);
+ int oldstate;
+ int newstate;
- /* first switch off both pause bits */
- int newstate = k->keepon &~ (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE);
+ if(!GOOD_EASY_HANDLE(data) || !data->conn)
+ /* crazy input, don't continue */
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+
+ k = &data->req;
+ oldstate = k->keepon & (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE);
- /* set the new desired pause bits */
- newstate |= ((action & CURLPAUSE_RECV)?KEEP_RECV_PAUSE:0) |
+ /* first switch off both pause bits then set the new pause bits */
+ newstate = (k->keepon &~ (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE)) |
+ ((action & CURLPAUSE_RECV)?KEEP_RECV_PAUSE:0) |
((action & CURLPAUSE_SEND)?KEEP_SEND_PAUSE:0);
if((newstate & (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE)) == oldstate) {
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnurl] 244/282: urldata: remove the 'stream_was_rewound' connectdata struct member, (continued)
- [gnurl] 244/282: urldata: remove the 'stream_was_rewound' connectdata struct member, gnunet, 2020/04/01
- [gnurl] 229/282: ci/tests: Make it possible to still run but ignore failing tests, gnunet, 2020/04/01
- [gnurl] 235/282: runtests.1: rephrase how to specify what tests to run, gnunet, 2020/04/01
- [gnurl] 241/282: MANUAL: update a dict-using command line, gnunet, 2020/04/01
- [gnurl] 232/282: THANKS: from 7.69.0, gnunet, 2020/04/01
- [gnurl] 245/282: transfer: set correct copyright year range, gnunet, 2020/04/01
- [gnurl] 239/282: polarssl: remove more references and mentions, gnunet, 2020/04/01
- [gnurl] 242/282: RELEASE-NOTES: synced, gnunet, 2020/04/01
- [gnurl] 248/282: pause: return early for calls that don't change pause state, gnunet, 2020/04/01
- [gnurl] 249/282: unit1612: fixed the inclusion and compilation of the HMAC unit test, gnunet, 2020/04/01
- [gnurl] 250/282: pause: bail out on bad input,
gnunet <=
- [gnurl] 247/282: curl_share_setopt.3: Note sharing cookies doesn't enable the engine, gnunet, 2020/04/01
- [gnurl] 257/282: perl: align order and completeness of Windows OS checks, gnunet, 2020/04/01
- [gnurl] 258/282: tests: use native Sleep function as fallback on Windows, gnunet, 2020/04/01
- [gnurl] 259/282: RELEASE-NOTES: synced, gnunet, 2020/04/01
- [gnurl] 234/282: cirrus-ci: disable the FreeBSD 13 builds, gnunet, 2020/04/01
- [gnurl] 243/282: Revert "pause: force-drain the transfer on unpause", gnunet, 2020/04/01
- [gnurl] 240/282: KNOWN_BUGS: configure --with-gssapi with Heimdal is ignored on macOS, gnunet, 2020/04/01
- [gnurl] 252/282: socks5: switch state properly when the resolve is done, gnunet, 2020/04/01
- [gnurl] 238/282: tests: wrap ignored test failures in braces, gnunet, 2020/04/01
- [gnurl] 255/282: seek: fix fallback for missing ftruncate on Windows, gnunet, 2020/04/01