[systemd-devel] [PATCH] Set error code on failure

Stanisław Pitucha viraptor at gmail.com
Mon Nov 17 21:40:18 PST 2014


Set the error code in case of incorrect name. This prevents continuing
and failing an assert(name) later on.
---
 src/resolve/resolved-dns-packet.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c
index 7f76285..3948f96 100644
--- a/src/resolve/resolved-dns-packet.c
+++ b/src/resolve/resolved-dns-packet.c
@@ -927,8 +927,10 @@ int dns_packet_read_name(DnsPacket *p, char **_ret,
 
                         earliest_compression_pointer = ptr;
                         p->rindex = ptr;
-                } else
+                } else {
+                        r = -EBADMSG;
                         goto fail;
+                }
         }
 
         if (!GREEDY_REALLOC(ret, allocated, n + 1)) {
-- 
2.1.2



More information about the systemd-devel mailing list