aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Zhukov <zhuk@openbsd.org>2015-07-28 14:08:52 +0000
committerVadim Zhukov <zhuk@openbsd.org>2015-07-28 14:08:52 +0000
commit73e0aef5b2bb0bc50ca67870b02b71d77150f312 (patch)
treed275e5a82aa3bdf6f78b72a310e384b6c6760eb5
parente8c995662696d6038d05dde43bf348d4549e36c0 (diff)
downloadopendoas-73e0aef5b2bb0bc50ca67870b02b71d77150f312.tar.gz
Fix keepenv handling. Initially reported by Ze Loff on misc@.
tedu@ agrees.
-rw-r--r--doas.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/doas.c b/doas.c
index 5fc1889..91b3f68 100644
--- a/doas.c
+++ b/doas.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: doas.c,v 1.27 2015/07/26 22:44:33 tedu Exp $ */
+/* $OpenBSD: doas.c,v 1.28 2015/07/27 15:38:11 espie Exp $ */
/*
* Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
*
@@ -256,8 +256,10 @@ copyenv(const char **oldenvp, struct rule *rule)
size_t j;
for (j = 0; j < nextras; j++) {
if (strcmp(extra[j], safeset[i]) == 0) {
- extra[j--] = extra[nextras--];
+ nextras--;
+ extra[j] = extra[nextras];
extra[nextras] = NULL;
+ j--;
}
}
}