projects
/
BearSSL
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Better handling of inet_ntop() failures (which should not happen in practice, since...
[BearSSL]
/
tools
/
client.c
diff --git
a/tools/client.c
b/tools/client.c
index
3686441
..
7acfebf
100644
(file)
--- a/
tools/client.c
+++ b/
tools/client.c
@@
-70,7
+70,9
@@
host_connect(const char *host, const char *port, int verbose)
addr = NULL;
}
if (addr != NULL) {
addr = NULL;
}
if (addr != NULL) {
- inet_ntop(p->ai_family, addr, tmp, sizeof tmp);
+ if (!inet_ntop(p->ai_family, addr, tmp, sizeof tmp)) {
+ strcpy(tmp, "<invalid>");
+ }
} else {
sprintf(tmp, "<unknown family: %d>",
(int)sa->sa_family);
} else {
sprintf(tmp, "<unknown family: %d>",
(int)sa->sa_family);
@@
-245,7
+247,11
@@
do_client(int argc, char *argv[])
usage_client();
goto client_exit_error;
}
usage_client();
goto client_exit_error;
}
- iobuf_len = strtoul(arg, 0, 10);
+ iobuf_len = parse_size(arg);
+ if (iobuf_len == (size_t)-1) {
+ usage_client();
+ goto client_exit_error;
+ }
} else if (eqstr(arg, "-CA")) {
if (++ i >= argc) {
fprintf(stderr,
} else if (eqstr(arg, "-CA")) {
if (++ i >= argc) {
fprintf(stderr,