1.7.1 ????-??-??
+ * bugfix #1260: Anticipate strchr returning NULL on unfound char
+ Thanks Stephan Zeisberg
* bugfix #1257: Free after reallocing to 0 size
Thanks Stephan Zeisberg
* bugfix #1256: Check parse limit before t increment
ldns_status
ldns_str2rdf_hip(ldns_rdf **rd, const char *str)
{
- const char *hit = strchr(str, ' ') + 1;
- const char *pk = hit == NULL ? NULL : strchr(hit, ' ') + 1;
+ const char *hit = str == NULL ? NULL : strchr(str, ' ');
+ const char *pk = hit == NULL ? NULL : strchr(hit + 1, ' ');
size_t hit_size = hit == NULL ? 0
- : pk == NULL ? strlen(hit) : (size_t) (pk - hit) - 1;
- size_t pk_size = pk == NULL ? 0 : strlen(pk);
+ : pk == NULL ? strlen(hit + 1) : (size_t) (pk - hit) - 1;
+ size_t pk_size = pk == NULL ? 0 : strlen(pk + 1);
size_t hit_wire_size = (hit_size + 1) / 2;
size_t pk_wire_size = ldns_b64_pton_calculate_size(pk_size);
size_t rdf_size = 4 + hit_wire_size + pk_wire_size;
return LDNS_STATUS_SYNTAX_ERR;
}
+ hit += 1;
+ pk += 1;
if ((data = LDNS_XMALLOC(uint8_t, rdf_size)) == NULL) {
return LDNS_STATUS_MEM_ERR;