summaryrefslogtreecommitdiffstats
path: root/usr.sbin/acme-client/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/acme-client/parse.y')
-rw-r--r--usr.sbin/acme-client/parse.y13
1 files changed, 4 insertions, 9 deletions
diff --git a/usr.sbin/acme-client/parse.y b/usr.sbin/acme-client/parse.y
index a6ecdda6fe3..bcc8325506a 100644
--- a/usr.sbin/acme-client/parse.y
+++ b/usr.sbin/acme-client/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.29 2018/08/03 17:57:21 benno Exp $ */
+/* $OpenBSD: parse.y,v 1.30 2018/09/07 07:35:30 miko Exp $ */
/*
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -839,17 +839,12 @@ cmdline_symset(char *s)
{
char *sym, *val;
int ret;
- size_t len;
if ((val = strrchr(s, '=')) == NULL)
return -1;
-
- len = strlen(s) - strlen(val) + 1;
- if ((sym = malloc(len)) == NULL)
- errx(EXIT_FAILURE, "cmdline_symset: malloc");
-
- strlcpy(sym, s, len);
-
+ sym = strndup(s, val - s);
+ if (sym == NULL)
+ errx(EXIT_FAILURE, "%s: strndup", __func__);
ret = symset(sym, val + 1, 1);
free(sym);