Commit 0d30d51f authored by Max Kellermann's avatar Max Kellermann

input_file, input_curl: check URL type before attempting to open

Don't attempt to open a HTTP URL as a local file, and don't send a local path to libcurl.
parent 35510866
...@@ -473,6 +473,9 @@ input_curl_open(struct input_stream *is, const char *url) ...@@ -473,6 +473,9 @@ input_curl_open(struct input_stream *is, const char *url)
struct input_curl *c; struct input_curl *c;
bool ret; bool ret;
if (strncmp(url, "http://", 7) != 0)
return false;
c = g_new0(struct input_curl, 1); c = g_new0(struct input_curl, 1);
c->url = g_strdup(url); c->url = g_strdup(url);
INIT_LIST_HEAD(&c->buffers); INIT_LIST_HEAD(&c->buffers);
......
...@@ -26,6 +26,9 @@ input_file_open(struct input_stream *is, const char *filename) ...@@ -26,6 +26,9 @@ input_file_open(struct input_stream *is, const char *filename)
{ {
FILE *fp; FILE *fp;
if (filename[0] != '/')
return false;
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (!fp) { if (!fp) {
is->error = errno; is->error = errno;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment