diff options
author | Alexander Couzens <lynxis@fe80.eu> | 2017-06-11 13:01:06 +0200 |
---|---|---|
committer | Alexander Couzens <lynxis@fe80.eu> | 2017-06-11 13:05:00 +0200 |
commit | 83ce236dab867842cdba88a57db50aae0fd9a4ce (patch) | |
tree | 058e1d9da429777db8e313fa4a872e2cc0f3e492 | |
parent | 52d955fd802a4d990b7ff9116f02ff52aa63ffec (diff) | |
download | uclient-83ce236dab867842cdba88a57db50aae0fd9a4ce.tar.gz |
uclient-fetch: read_data_cb: fix a potential buffer overflow
When a backend->read() is not implement or returns -1,
This -1 is interpreted as unsigned int resulting
in an access far behind the buffer.
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
-rw-r--r-- | uclient-fetch.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/uclient-fetch.c b/uclient-fetch.c index d9582f5..dff144b 100644 --- a/uclient-fetch.c +++ b/uclient-fetch.c @@ -262,7 +262,7 @@ static void read_data_cb(struct uclient *cl) while (1) { len = uclient_read(cl, buf, sizeof(buf)); - if (!len) + if (len <= 0) return; out_bytes += len; |