about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-12-07 13:43:46 -0500
committerJune McEnroe <june@causal.agency>2020-12-07 13:43:46 -0500
commit3ab4752c5685a2612135e4c34c9cbdffc1eb3038 (patch)
tree286f269ca902ce15117fac4afd1561a6aeff2679
parentRemove use of AI_DEFAULT (diff)
downloadbubger-3ab4752c5685a2612135e4c34c9cbdffc1eb3038.tar.gz
bubger-3ab4752c5685a2612135e4c34c9cbdffc1eb3038.zip
Correctly handle . in nameString
-rw-r--r--getservinfo.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/getservinfo.c b/getservinfo.c
index 0db7bc0..7565ef1 100644
--- a/getservinfo.c
+++ b/getservinfo.c
@@ -57,7 +57,8 @@ static void nameSkip(uint8_t **ptr) {
 }
 
 static char *nameString(uint8_t **ptr) {
-	char *name = (char *)(*ptr + 1);
+	char *name = (char *)*ptr;
+	if (**ptr) name++;
 	for (uint8_t len; (len = **ptr); *ptr += len) {
 		*(*ptr)++ = '.';
 	}