@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-License-Identifier: ISC
|
* SPDX-License-Identifier: ISC
|
||||||
*
|
*
|
||||||
* Copyright (c) 2010-2015 Todd C. Miller <Todd.Miller@sudo.ws>
|
* Copyright (c) 2010-2015, 2020-2022 Todd C. Miller <Todd.Miller@sudo.ws>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
@@ -103,10 +103,8 @@ copy_arg(const char *src, size_t len)
|
|||||||
if ((copy = malloc(len + 1)) != NULL) {
|
if ((copy = malloc(len + 1)) != NULL) {
|
||||||
sudoers_gc_add(GC_PTR, copy);
|
sudoers_gc_add(GC_PTR, copy);
|
||||||
for (dst = copy; src < src_end; ) {
|
for (dst = copy; src < src_end; ) {
|
||||||
if (src[0] == '\\' && src[1] != '\0') {
|
if (src[0] == '\\' && src[1] != '\0')
|
||||||
src++;
|
src++;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
*dst++ = *src++;
|
*dst++ = *src++;
|
||||||
}
|
}
|
||||||
*dst = '\0';
|
*dst = '\0';
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-License-Identifier: ISC
|
* SPDX-License-Identifier: ISC
|
||||||
*
|
*
|
||||||
* Copyright (c) 2021 Todd C. Miller <Todd.Miller@sudo.ws>
|
* Copyright (c) 2021-2022 Todd C. Miller <Todd.Miller@sudo.ws>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
@@ -63,6 +63,15 @@ struct test_data {
|
|||||||
3,
|
3,
|
||||||
{ "/usr/bin/vi\\", "--", "/etc/hosts", "/bogus/file", NULL }
|
{ "/usr/bin/vi\\", "--", "/etc/hosts", "/bogus/file", NULL }
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
/* GitHub issue #179 */
|
||||||
|
"EDITOR=sed -rie s/^\\\\(foo\\\\)/waldo\\\\1/",
|
||||||
|
1,
|
||||||
|
{ "/etc/sudoers", NULL },
|
||||||
|
"/usr/bin/sed",
|
||||||
|
5,
|
||||||
|
{ "sed", "-rie", "s/^\\(foo\\)/waldo\\1/", "--", "/etc/sudoers", NULL }
|
||||||
|
},
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user