summaryrefslogtreecommitdiff
path: root/llmnr-query.c
diff options
context:
space:
mode:
Diffstat (limited to 'llmnr-query.c')
-rw-r--r--llmnr-query.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/llmnr-query.c b/llmnr-query.c
index 1706add..e5d3557 100644
--- a/llmnr-query.c
+++ b/llmnr-query.c
@@ -344,12 +344,13 @@ int main(int argc, char **argv)
if (ptr < p->size - 1) {
uint8_t nnl = p->data[ptr];
strncpy(name, (char *)&p->data[ptr + 1], nnl);
+ name[nnl] = '\0';
} else
strncpy(name, "<invalid>", LLMNR_LABEL_MAX_SIZE);
- } else
+ } else {
strncpy(name, (char *)pkt_put(p, nl + 1), nl);
-
- name[LLMNR_LABEL_MAX_SIZE] = '\0';
+ name[nl] = '\0';
+ }
type = htons(pkt_put_extract_u16(p));
clss = htons(pkt_put_extract_u16(p));