check for length > 0 before calling ustream_write
authorFelix Fietkau <nbd@openwrt.org>
Sat, 22 Mar 2014 17:21:01 +0000 (18:21 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 22 Mar 2014 17:21:01 +0000 (18:21 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
uclient-http.c

index c3d1d5a7e06d04a8ae4d1e3a384e6bf289d60f9b..c344513d8c7c4722e1a34f3f03e6d016a4eb0f8a 100644 (file)
@@ -741,7 +741,8 @@ uclient_http_send_data(struct uclient *cl, char *buf, unsigned int len)
        uclient_http_send_headers(uh);
 
        ustream_printf(uh->us, "%X\r\n", len);
-       ustream_write(uh->us, buf, len, false);
+       if (len > 0)
+               ustream_write(uh->us, buf, len, false);
        ustream_printf(uh->us, "\r\n");
 
        return len;