From 8d981a07f9d3d73cdd0a823a675277dc8526e166 Mon Sep 17 00:00:00 2001 From: epoch Date: Mon, 5 Sep 2022 03:25:55 -0500 Subject: urifromline was crashing when being passed argv[1] directly --- urigetline.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 #include + #include #include @@ -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; -- cgit v1.2.3