From 16c46c31836bf3b5ecfdb6299ef562bcfa383807 Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Sun, 11 Jun 2006 17:26:13 +0000 Subject: [PATCH] No segfaults please --- dns.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dns.c b/dns.c index 2039528..cde74be 100644 --- a/dns.c +++ b/dns.c @@ -618,7 +618,9 @@ dnsd_read(int fd, char *buf, int buflen) r = decodepacket(name, &packetbuf); - memcpy(buf, packetbuf.data, r); + if (r > 0) { + memcpy(buf, packetbuf.data, r); + } return r; }