mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-16 01:03:16 -05:00
Merge pull request #435 from wolfmanx/mpd-argument-unquoting
[mpd] Quoted argument unescaping fixed
This commit is contained in:
commit
75b14b85e9
24
src/mpd.c
24
src/mpd.c
@ -318,32 +318,36 @@ static char*
|
|||||||
mpd_pars_quoted(char **input)
|
mpd_pars_quoted(char **input)
|
||||||
{
|
{
|
||||||
char *arg;
|
char *arg;
|
||||||
|
char *src;
|
||||||
|
char *dst;
|
||||||
|
char ch;
|
||||||
|
|
||||||
// skip double quote character
|
// skip double quote character
|
||||||
(*input)++;
|
(*input)++;
|
||||||
|
|
||||||
arg = *input;
|
src = dst = arg = *input;
|
||||||
|
while ((ch = *src) != '"')
|
||||||
while (**input != '"')
|
|
||||||
{
|
{
|
||||||
// A backslash character escapes the following character
|
// A backslash character escapes the following character and should be removed
|
||||||
if (**input == '\\')
|
if (ch == '\\')
|
||||||
{
|
{
|
||||||
(*input)++;
|
ch = *(++src);
|
||||||
}
|
}
|
||||||
|
*dst++ = ch;
|
||||||
|
|
||||||
if (**input == 0)
|
if (ch == 0)
|
||||||
{
|
{
|
||||||
// Error handling for missing double quote at end of parameter
|
// Error handling for missing double quote at end of parameter
|
||||||
DPRINTF(E_LOG, L_MPD, "Error missing closing double quote in argument\n");
|
DPRINTF(E_LOG, L_MPD, "Error missing closing double quote in argument\n");
|
||||||
|
*input = src;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*input)++;
|
++src;
|
||||||
}
|
}
|
||||||
|
|
||||||
**input = '\0';
|
*dst = '\0';
|
||||||
(*input)++;
|
*input = ++src;
|
||||||
|
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user