aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-14 14:15:01 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-14 14:15:01 +0000
commit91516a1fd63de8423db146794f72bff8ec0191fa (patch)
tree78d064a574c6c9577c49b52bda72bd48c52522ca /contrib
parent7fffcf4121b7650062c516356f9aa8448d9f3d51 (diff)
downloadrspamd-91516a1fd63de8423db146794f72bff8ec0191fa.tar.gz
rspamd-91516a1fd63de8423db146794f72bff8ec0191fa.zip
Fix issues with freeing of bad rdns requests
Diffstat (limited to 'contrib')
-rw-r--r--contrib/librdns/packet.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/contrib/librdns/packet.c b/contrib/librdns/packet.c
index 88e51dfba..630413fdb 100644
--- a/contrib/librdns/packet.c
+++ b/contrib/librdns/packet.c
@@ -158,8 +158,7 @@ rdns_format_dns_name (struct rdns_resolver *resolver, const char *in,
}
else {
rdns_info ("no buffer remain for punycoding query");
- free (*out);
- return false;
+ goto err;
}
free (uclabel);
@@ -183,7 +182,7 @@ rdns_format_dns_name (struct rdns_resolver *resolver, const char *in,
}
if (remain < label_len + 1) {
rdns_info ("no buffer remain for punycoding query");
- return false;
+ goto err;
}
if (label_len == 0) {
/* Two dots in order, skip this */
@@ -208,7 +207,7 @@ rdns_format_dns_name (struct rdns_resolver *resolver, const char *in,
}
if (remain < label_len + 1) {
rdns_info ("no buffer remain for punycoding query");
- return false;
+ goto err;
}
memcpy (o, p, label_len);
o += label_len;
@@ -220,7 +219,7 @@ rdns_format_dns_name (struct rdns_resolver *resolver, const char *in,
}
if (remain == 0) {
rdns_info ("no buffer remain for punycoding query");
- return false;
+ goto err;
}
}
*o = '\0';
@@ -228,6 +227,11 @@ rdns_format_dns_name (struct rdns_resolver *resolver, const char *in,
*outlen = o - *out;
return true;
+
+ err:
+ free (*out);
+ *out = NULL;
+ return false;
}
bool