summaryrefslogtreecommitdiff
path: root/urigetline.c
diff options
context:
space:
mode:
authorepoch <epoch@thebackupbox.net>2022-09-05 03:25:55 -0500
committerepoch <epoch@thebackupbox.net>2022-09-05 03:25:55 -0500
commit8d981a07f9d3d73cdd0a823a675277dc8526e166 (patch)
treeb6b62fc50bd575e8b5ed46de5e9323f3ef71325d /urigetline.c
parentf14b89fb90175e659e5652da50b5fc4fb4ca47c3 (diff)
downloaduritools-8d981a07f9d3d73cdd0a823a675277dc8526e166.tar.gz
uritools-8d981a07f9d3d73cdd0a823a675277dc8526e166.zip
urifromline was crashing when being passed argv[1] directly
Diffstat (limited to 'urigetline.c')
-rw-r--r--urigetline.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/urigetline.c b/urigetline.c
index 4963a84..eb8ab6b 100644
--- a/urigetline.c
+++ b/urigetline.c
@@ -1,6 +1,8 @@
+#define _XOPEN_SOURCE 500
#include "uri.h"
#include <stdio.h>
#include <stdlib.h>
+
#include <string.h>
#include <fnmatch.h>
@@ -60,7 +62,7 @@ int main(int argc,char *argv[]) {//argument needs to be the URI
free(u);
return 1;
}
- urifromline(u,argv[1]);//only argv[1] is a URI?
+ urifromline(u,strdup(argv[1]));
for(;fgets(line,LINE_LENGTH-1,stdin);) {//each line comes from the config. we need to split it on spaces.
if(strchr(line,'\r')) *strchr(line,'\r')=0;
if(strchr(line,'\n')) *strchr(line,'\n')=0;