diff mbox series

handlers: swuforward: Fix CID 292163 and 292165

Message ID 20200409135458.7794-1-toertel@gmail.com
State Accepted
Headers show
Series handlers: swuforward: Fix CID 292163 and 292165 | expand

Commit Message

Mark Jonas April 9, 2020, 1:54 p.m. UTC
nbytes and written are compared against values less than 0. Thus, they
need to have a signed type. read() and write() return ssize_t. So, this
is the right type.

Signed-off-by: Mark Jonas <toertel@gmail.com>
---
 handlers/swuforward_handler.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Stefano Babic April 9, 2020, 2:17 p.m. UTC | #1
On 09.04.20 15:54, Mark Jonas wrote:
> nbytes and written are compared against values less than 0. Thus, they
> need to have a signed type. read() and write() return ssize_t. So, this
> is the right type.
> 
> Signed-off-by: Mark Jonas <toertel@gmail.com>
> ---
>  handlers/swuforward_handler.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/handlers/swuforward_handler.c b/handlers/swuforward_handler.c
> index 4ddaf35..2febdd0 100644
> --- a/handlers/swuforward_handler.c
> +++ b/handlers/swuforward_handler.c
> @@ -55,7 +55,7 @@ struct hnd_priv {
>  static size_t curl_read_data(char *buffer, size_t size, size_t nmemb, void *userp)
>  {
>  	struct curlconn *conn = (struct curlconn *)userp;
> -	size_t nbytes;
> +	ssize_t nbytes;
>  
>  	if (!nmemb)
>  		return 0;
> @@ -94,7 +94,7 @@ static size_t curl_read_data(char *buffer, size_t size, size_t nmemb, void *user
>  static int swu_forward_data(void *data, const void *buf, unsigned int len)
>  {
>  	struct hnd_priv *priv = (struct hnd_priv *)data;
> -	size_t written;
> +	ssize_t written;
>  	struct curlconn *conn;
>  	int index = 0;
>  
> 

Applied (as the previous patches) to -master, thanks !

Best regards,
Stefao Babic
diff mbox series

Patch

diff --git a/handlers/swuforward_handler.c b/handlers/swuforward_handler.c
index 4ddaf35..2febdd0 100644
--- a/handlers/swuforward_handler.c
+++ b/handlers/swuforward_handler.c
@@ -55,7 +55,7 @@  struct hnd_priv {
 static size_t curl_read_data(char *buffer, size_t size, size_t nmemb, void *userp)
 {
 	struct curlconn *conn = (struct curlconn *)userp;
-	size_t nbytes;
+	ssize_t nbytes;
 
 	if (!nmemb)
 		return 0;
@@ -94,7 +94,7 @@  static size_t curl_read_data(char *buffer, size_t size, size_t nmemb, void *user
 static int swu_forward_data(void *data, const void *buf, unsigned int len)
 {
 	struct hnd_priv *priv = (struct hnd_priv *)data;
-	size_t written;
+	ssize_t written;
 	struct curlconn *conn;
 	int index = 0;