aboutsummaryrefslogtreecommitdiff
path: root/src/protocol.c
diff options
context:
space:
mode:
authorDavid Timber <mieabby@gmail.com>2021-04-09 20:39:23 +1000
committerDavid Timber <mieabby@gmail.com>2021-04-09 20:39:23 +1000
commitd99b1309b1c699103c26b316a373a64f5342b905 (patch)
tree7f4b6feefb83f0d6217d4a48c5602d88f4a979a7 /src/protocol.c
parent875462207d4b702c98a3ef994caef8b1c95a1d9d (diff)
Impl hostinfod, bug fix and more
* Merge /src/data/sql/hi-create.sql and /src/data/sql/hi-view.sql * Fix false failure when allocation size is zero * Add "FIXME" comment where it is not clear whether zero size is normal case. * Fix typo in /src/proone-bne.c * "proone-htbthost": always verify ALPN * Fix crash bug in `prne_htbt_dser_host_info()`
Diffstat (limited to 'src/protocol.c')
-rw-r--r--src/protocol.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/protocol.c b/src/protocol.c
index 85a2142..b89b09a 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -262,7 +262,7 @@ bool prne_htbt_alloc_host_info (
}
ny_mem = prne_calloc(1, cred_len);
- if (ny_mem == NULL) {
+ if (ny_mem == NULL && cred_len > 0) {
return false;
}
@@ -345,6 +345,9 @@ bool prne_htbt_alloc_cmd (
if (0 < argc) {
mem_len = pos;
args = (char**)prne_malloc(sizeof(char*), argc + 1);
+ /* FIXME
+ * What if mem_len == 0?
+ */
mem = (char*)prne_malloc(1, mem_len);
if (args == NULL || mem == NULL) {
goto ERR;
@@ -832,7 +835,6 @@ prne_htbt_ser_rc_t prne_htbt_dser_host_info (
data[91]);
out->arch = (prne_arch_t)data[93];
memcpy(out->host_cred, data + 94, cred_size);
- out->host_cred[cred_size] = 0;
return PRNE_HTBT_SER_RC_OK;
}
@@ -881,6 +883,9 @@ prne_htbt_ser_rc_t prne_htbt_dser_cmd (
}
if (args_len > 0) {
+ /* FIXME
+ * args_len == 0 allowed?
+ */
mem = (char*)prne_malloc(1, args_len);
if (mem == NULL) {
ret = PRNE_HTBT_SER_RC_ERRNO;