Commit Diff


commit - 3d8e0c5ede1a5654397b63a9f483d875543527d5
commit + 4cdd299d8c1d142b26efc3351dbab1c185f2c492
blob - 342886d6f2c8b12ed3548eb39f4ce4d40be487d1
blob + 84e9b08cfad055d23554ebba81fc37fa15e8cdc9
--- gotwebd/parse.y
+++ gotwebd/parse.y
@@ -918,18 +918,14 @@ cmdline_symset(char *s)
 {
 	char *sym, *val;
 	int ret;
-	size_t len;
 
 	val = strrchr(s, '=');
 	if (val == NULL)
 		return (-1);
 
-	len = strlen(s) - strlen(val) + 1;
-	sym = malloc(len);
+	sym = strndup(s, val - s);
 	if (sym == NULL)
-		fatal("%s: malloc", __func__);
-
-	memcpy(&sym, s, len);
+		fatal("%s: strndup", __func__);
 
 	ret = symset(sym, val + 1, 1);
 	free(sym);