summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2014-05-30 13:00:40 +0000
committerBob Beck <beck@cvs.openbsd.org>2014-05-30 13:00:40 +0000
commitfdf3730e2ac24c749826cf2730bba6c7bebb26af (patch)
treeb51d30ecc430a7ce998cd030ac9686868141fe69
parentd15ac4820e36f6e5302081a89c405ff5bff1922f (diff)
Fix some more nasty stringyness in here by using asprintf instead of cruft.
gets rid of the second last use of the awful DECIMAL_SIZE.
-rw-r--r--lib/libcrypto/bio/bss_conn.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/libcrypto/bio/bss_conn.c b/lib/libcrypto/bio/bss_conn.c
index a31e5a170bb..3175b94112a 100644
--- a/lib/libcrypto/bio/bss_conn.c
+++ b/lib/libcrypto/bio/bss_conn.c
@@ -472,22 +472,19 @@ conn_ctrl(BIO *b, int cmd, long num, void *ptr)
free(data->param_port);
data->param_port = BUF_strdup(ptr);
} else if (num == 2) {
- char buf[16];
unsigned char *p = ptr;
-
- snprintf(buf, sizeof buf, "%d.%d.%d.%d",
- p[0], p[1], p[2], p[3]);
free(data->param_hostname);
- data->param_hostname = BUF_strdup(buf);
+ if (asprintf(&data->param_hostname,
+ "%u.%u.%u.%u", p[0], p[1],
+ p[2], p[3]) == -1)
+ data->param_hostname = NULL;
memcpy(&(data->ip[0]), ptr, 4);
} else if (num == 3) {
- char buf[DECIMAL_SIZE(int) + 1];
-
- snprintf(buf, sizeof buf, "%d",
- *(int *)ptr);
free(data->param_port);
- data->param_port = BUF_strdup(buf);
data->port= *(int *)ptr;
+ if (asprintf(&data->param_port, "%d",
+ data->port) == -1)
+ data->param_port = NULL;
}
}
break;