diff options
author | deraadt <> | 2019-07-03 03:24:04 +0000 |
---|---|---|
committer | deraadt <> | 2019-07-03 03:24:04 +0000 |
commit | ef84a12d8fc3f2dacb57102d5f84bfb4025a320a (patch) | |
tree | 095ed8468464d046dbf7618376c0a18af76dceba /src/usr.bin/nc/socks.c | |
parent | 88ab3711341dea97a3118b0654ceab1679d5e0a1 (diff) | |
download | openbsd-ef84a12d8fc3f2dacb57102d5f84bfb4025a320a.tar.gz openbsd-ef84a12d8fc3f2dacb57102d5f84bfb4025a320a.tar.bz2 openbsd-ef84a12d8fc3f2dacb57102d5f84bfb4025a320a.zip |
snprintf/vsnprintf return < 0 on error, rather than -1.
Diffstat (limited to 'src/usr.bin/nc/socks.c')
-rw-r--r-- | src/usr.bin/nc/socks.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/usr.bin/nc/socks.c b/src/usr.bin/nc/socks.c index 856c3e7446..39e4331be3 100644 --- a/src/usr.bin/nc/socks.c +++ b/src/usr.bin/nc/socks.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: socks.c,v 1.27 2019/01/10 12:44:54 mestre Exp $ */ | 1 | /* $OpenBSD: socks.c,v 1.28 2019/07/03 03:24:02 deraadt Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 1999 Niklas Hallqvist. All rights reserved. | 4 | * Copyright (c) 1999 Niklas Hallqvist. All rights reserved. |
@@ -334,7 +334,7 @@ socks_connect(const char *host, const char *port, | |||
334 | "CONNECT %s:%d HTTP/1.0\r\n", | 334 | "CONNECT %s:%d HTTP/1.0\r\n", |
335 | host, ntohs(serverport)); | 335 | host, ntohs(serverport)); |
336 | } | 336 | } |
337 | if (r == -1 || (size_t)r >= sizeof(buf)) | 337 | if (r < 0 || (size_t)r >= sizeof(buf)) |
338 | errx(1, "hostname too long"); | 338 | errx(1, "hostname too long"); |
339 | r = strlen(buf); | 339 | r = strlen(buf); |
340 | 340 | ||
@@ -357,7 +357,7 @@ socks_connect(const char *host, const char *port, | |||
357 | errx(1, "Proxy username/password too long"); | 357 | errx(1, "Proxy username/password too long"); |
358 | r = snprintf(buf, sizeof(buf), "Proxy-Authorization: " | 358 | r = snprintf(buf, sizeof(buf), "Proxy-Authorization: " |
359 | "Basic %s\r\n", resp); | 359 | "Basic %s\r\n", resp); |
360 | if (r == -1 || (size_t)r >= sizeof(buf)) | 360 | if (r < 0 || (size_t)r >= sizeof(buf)) |
361 | errx(1, "Proxy auth response too long"); | 361 | errx(1, "Proxy auth response too long"); |
362 | r = strlen(buf); | 362 | r = strlen(buf); |
363 | if ((cnt = atomicio(vwrite, proxyfd, buf, r)) != r) | 363 | if ((cnt = atomicio(vwrite, proxyfd, buf, r)) != r) |