[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] misc: Allow %% to escape a single % in paths.
[Thread Prev] | [Thread Next]
- Subject: [PATCH] misc: Allow %% to escape a single % in paths.
- From: "Richard W.M. Jones" <rjones@xxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Wed, 3 Apr 2019 13:03:10 +0100
- To: libssh@xxxxxxxxxx
For example "%d/config%%1" is expanded to "~/.ssh/config%1".
---
src/misc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/misc.c b/src/misc.c
index dccb12a3..c918fc49 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -819,6 +819,7 @@ char *ssh_path_expand_escape(ssh_session session, const char *s) {
for (i = 0; *p != '\0'; p++) {
if (*p != '%') {
+ escape:
buf[i] = *p;
i++;
if (i >= MAX_BUF_SIZE) {
@@ -835,6 +836,8 @@ char *ssh_path_expand_escape(ssh_session session, const char *s) {
}
switch (*p) {
+ case '%':
+ goto escape;
case 'd':
x = strdup(session->opts.sshdir);
break;
--
2.20.1
| Re: [PATCH] misc: Allow %% to escape a single % in paths. | "Richard W.M. Jones" <rjones@xxxxxxxxxx> |