diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2010-01-25 19:33:54 +0100 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2010-01-25 19:33:54 +0100 |
commit | 0b39142b67849cb20dffcdac48b2886a33968fbb (patch) | |
tree | d21da52e4c420deb6fd5d26c9b181a15e323e8a5 | |
parent | 53a6a7faa01aa0c6a65ee875c7d59c2405278890 (diff) |
prevent adding URIs with invalid characters
-rw-r--r-- | playlist.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -614,6 +614,8 @@ pl_insert_file (playItem_t *after, const char *fname, int *pabort, int (*cb)(pla if (strncasecmp (fname, "file://", 7)) { const char *p = fname; int detect_on_access = 1; + + // check if it's URI for (; *p; p++) { if (!strncmp (p, "://", 3)) { break; @@ -623,7 +625,18 @@ pl_insert_file (playItem_t *after, const char *fname, int *pabort, int (*cb)(pla break; } } + if (detect_on_access && *p == ':') { + // check for wrong chars like CR/LF, TAB, etc + // they are not allowed and might lead to corrupt display in GUI + int32_t i = 0; + while (fname[i]) { + uint32_t c = u8_nextchar (fname, &i); + if (c < 0x20) { + return NULL; + } + } + playItem_t *it = pl_item_alloc (); it->decoder = NULL; it->fname = strdup (fname); |