[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] misc: Allow %% to escape a single % in paths.
[Thread Prev] | [Thread Next]
[Date Prev] | [Date Next]
- Subject: Re: [PATCH] misc: Allow %% to escape a single % in paths.
- From: Jakub Jelen <jjelen@xxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Mon, 29 Apr 2019 11:54:04 +0200
- To: libssh@xxxxxxxxxx
On Wed, 2019-04-03 at 13:05 +0100, Richard W.M. Jones wrote:
> On Wed, Apr 03, 2019 at 01:03:10PM +0100, Richard W.M. Jones wrote:
> > For example "%d/config%%1" is expanded to "~/.ssh/config%1".
>
> Sorry, I forgot the s-o-b, so:
>
> Signed-off-by: Richard W.M. Jones <rjones@xxxxxxxxxx>
>
> > 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
Hello Richard,
thank you for your contribution and sorry for a late reply. Could you
please try to extend also the unit tests to trigger this code path?
Thank you,
--
Jakub Jelen
Senior Software Engineer
Security Technologies
Red Hat, Inc.
| [PATCH] misc: Allow %% to escape a single % in paths. | "Richard W.M. Jones" <rjones@xxxxxxxxxx> |
| Re: [PATCH] misc: Allow %% to escape a single % in paths. | "Richard W.M. Jones" <rjones@xxxxxxxxxx> |