]> git.armaanb.net Git - opendoas.git/commitdiff
Fix keepenv handling. Initially reported by Ze Loff on misc@.
authorVadim Zhukov <zhuk@openbsd.org>
Tue, 28 Jul 2015 14:08:52 +0000 (14:08 +0000)
committerVadim Zhukov <zhuk@openbsd.org>
Tue, 28 Jul 2015 14:08:52 +0000 (14:08 +0000)
tedu@ agrees.

doas.c

diff --git a/doas.c b/doas.c
index 5fc188919baed4e0c72edeb9b80286aecef94070..91b3f68f357de0572eb0b2588446d6b899c684b4 100644 (file)
--- 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--;
                                }
                        }
                }