diff options
| author | Přemysl Eric Janouch <p@janouch.name> | 2024-08-07 22:04:00 +0200 | 
|---|---|---|
| committer | Přemysl Eric Janouch <p@janouch.name> | 2024-08-07 22:04:00 +0200 | 
| commit | 8a8437634a2dc58768172f481ccf3c6637745d46 (patch) | |
| tree | 8c838e6f7ab27018b1075949719d6f81740ecd77 /liberty-proto.c | |
| parent | e78b410a6afff53d61a4caf9c6e76fb995e0bc76 (diff) | |
| download | liberty-8a8437634a2dc58768172f481ccf3c6637745d46.tar.gz liberty-8a8437634a2dc58768172f481ccf3c6637745d46.tar.xz liberty-8a8437634a2dc58768172f481ccf3c6637745d46.zip | |
MPD client: fix argument quoting
Diffstat (limited to 'liberty-proto.c')
| -rw-r--r-- | liberty-proto.c | 16 | 
1 files changed, 8 insertions, 8 deletions
| diff --git a/liberty-proto.c b/liberty-proto.c index 577fcda..d4355c7 100644 --- a/liberty-proto.c +++ b/liberty-proto.c @@ -1636,29 +1636,29 @@ mpd_client_on_ready (const struct pollfd *pfd, void *user_data)  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  static bool -mpd_client_must_quote_char (char c) -{ -	return (unsigned char) c <= ' ' || c == '"' || c == '\''; -} - -static bool  mpd_client_must_quote (const char *s)  {  	if (!*s)  		return true;  	for (; *s; s++) -		if (mpd_client_must_quote_char (*s)) +		if ((unsigned char) *s <= ' ' || *s == '"' || *s == '\'')  			return true;  	return false;  } +static bool +mpd_client_must_escape_in_quote (char c) +{ +	return c == '"' || c == '\'' || c == '\\'; +} +  static void  mpd_client_quote (const char *s, struct str *output)  {  	str_append_c (output, '"');  	for (; *s; s++)  	{ -		if (mpd_client_must_quote_char (*s)) +		if (mpd_client_must_escape_in_quote (*s))  			str_append_c (output, '\\');  		str_append_c (output, *s);  	} | 
