Returning strings does include the null byte

This commit is contained in:
Willem Toorop 2015-12-29 16:17:17 +01:00
parent 5a388386b4
commit ebe3d361ea
2 changed files with 4 additions and 2 deletions

View File

@ -3268,7 +3268,8 @@ getdns_context_get_suffix(getdns_context *context, getdns_list **value)
r = GETDNS_RETURN_GENERIC_ERROR; r = GETDNS_RETURN_GENERIC_ERROR;
break; break;
} }
if ((r = _getdns_list_append_string(list, name))) if ((r = _getdns_list_append_const_bindata(
list, strlen(name), name)))
break; break;
dname += dname_len; dname += dname_len;
dname_len = *dname++; dname_len = *dname++;

View File

@ -280,7 +280,8 @@ getdns_dict_get_names(const getdns_dict *dict, getdns_list **answer)
RBTREE_FOR(item, struct getdns_dict_item *, RBTREE_FOR(item, struct getdns_dict_item *,
(_getdns_rbtree_t *)&(dict->root)) { (_getdns_rbtree_t *)&(dict->root)) {
_getdns_list_append_string(*answer, item->node.key); _getdns_list_append_const_bindata(*answer,
strlen(item->node.key) + 1, item->node.key);
} }
return GETDNS_RETURN_GOOD; return GETDNS_RETURN_GOOD;
} /* getdns_dict_get_names */ } /* getdns_dict_get_names */