Skip to content

Commit

Permalink
Fix issue with PTR generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed May 1, 2014
1 parent 2838695 commit 440bef8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ rdns_generate_ptr_from_str (const char *str)
unsigned char *bytes;
size_t len;

if (inet_pton (AF_INET, str, &addr.v4) == 0) {
if (inet_pton (AF_INET, str, &addr.v4) == 1) {
bytes = (unsigned char *)&addr.v4;

len = 4 * 4 + sizeof ("in-addr.arpa");
Expand All @@ -490,7 +490,7 @@ rdns_generate_ptr_from_str (const char *str)
bytes[3], bytes[2], bytes[1], bytes[0]);
}
}
else if (inet_pton (AF_INET6, str, &addr.v6) == 0) {
else if (inet_pton (AF_INET6, str, &addr.v6) == 1) {
bytes = (unsigned char *)&addr.v6;

len = 2*32 + sizeof ("ip6.arpa");
Expand Down

0 comments on commit 440bef8

Please sign in to comment.