command: "update" checks if the path is malformed
This is a very basic check, which only ensures that the path does not begin with a slash, doesn't have double slashes and the special names "." and ".." are forbidden.
This commit is contained in:
parent
43cf4e97b9
commit
a3645984cd
1
NEWS
1
NEWS
|
@ -10,6 +10,7 @@ ver 0.16 (20??/??/??)
|
|||
- "load" supports remote playlists (extm3u, pls, asx, xspf, lastfm://)
|
||||
- allow changing replay gain mode on-the-fly
|
||||
- omitting the range end is possible
|
||||
- "update" checks if the path is malformed
|
||||
* archive:
|
||||
- iso: renamed plugin to "iso9660"
|
||||
- zip: renamed plugin to "zzip"
|
||||
|
|
|
@ -1055,9 +1055,16 @@ handle_update(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
|
|||
unsigned ret;
|
||||
|
||||
assert(argc <= 2);
|
||||
if (argc == 2)
|
||||
if (argc == 2) {
|
||||
path = argv[1];
|
||||
|
||||
if (!uri_safe_local(path)) {
|
||||
command_error(client, ACK_ERROR_ARG,
|
||||
"Malformed path");
|
||||
return COMMAND_RETURN_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
ret = update_enqueue(path, false);
|
||||
if (ret > 0) {
|
||||
client_printf(client, "updating_db: %i\n", ret);
|
||||
|
@ -1076,9 +1083,16 @@ handle_rescan(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
|
|||
unsigned ret;
|
||||
|
||||
assert(argc <= 2);
|
||||
if (argc == 2)
|
||||
if (argc == 2) {
|
||||
path = argv[1];
|
||||
|
||||
if (!uri_safe_local(path)) {
|
||||
command_error(client, ACK_ERROR_ARG,
|
||||
"Malformed path");
|
||||
return COMMAND_RETURN_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
ret = update_enqueue(path, true);
|
||||
if (ret > 0) {
|
||||
client_printf(client, "updating_db: %i\n", ret);
|
||||
|
|
Loading…
Reference in New Issue