Skip to content

Commit 8492a16

Browse files
committed
fixed problem with convertBinData() not converting root name correctly
1 parent e358406 commit 8492a16

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

pygetdns_util.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,19 @@ convertBinData(getdns_bindata* data,
373373

374374

375375
size_t i;
376-
376+
377+
378+
// the root
379+
if (data->size == 1 && data->data[0] == 0) {
380+
PyObject *a_string;
381+
382+
if ((a_string = PyString_FromString(".")) == NULL) {
383+
PyErr_SetString(getdns_error, GETDNS_RETURN_GENERIC_ERROR_TEXT);
384+
return NULL;
385+
}
386+
return(a_string);
387+
}
388+
377389
int printable = 1;
378390
for (i = 0; i < data->size; ++i) {
379391
if (!isprint(data->data[i])) {
@@ -396,16 +408,6 @@ convertBinData(getdns_bindata* data,
396408
return(a_string);
397409
}
398410

399-
// the root
400-
if (data->size == 1 && data->data[0] == 0) {
401-
PyObject *a_string;
402-
403-
if ((a_string = PyString_FromString(".")) == NULL) {
404-
PyErr_SetString(getdns_error, GETDNS_RETURN_GENERIC_ERROR_TEXT);
405-
return NULL;
406-
}
407-
return(a_string);
408-
}
409411

410412
// dname
411413
if (priv_getdns_bindata_is_dname(data)) {

0 commit comments

Comments
 (0)