From: John Hodge Date: Mon, 18 Feb 2013 15:50:16 +0000 (+0800) Subject: Usermode/liburi - Fixed off-by-one in path code X-Git-Tag: rel0.15~558 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=e1e28eeec4619359322227478d826e3dcdd0a09d;p=tpg%2Facess2.git Usermode/liburi - Fixed off-by-one in path code --- diff --git a/Usermode/Libraries/liburi.so_src/main.c b/Usermode/Libraries/liburi.so_src/main.c index e8f8dea0..a9f2e175 100644 --- a/Usermode/Libraries/liburi.so_src/main.c +++ b/Usermode/Libraries/liburi.so_src/main.c @@ -63,7 +63,7 @@ tURI *URI_Parse(const char *String) { int hostlen, portlen, pathlen; tmp += 3; // Eat '://' - ret = malloc(sizeof(tURI) + strlen(String) - 2); + ret = malloc(sizeof(tURI) + protolen + 1 + strlen(tmp) + 1); ret->Proto = (char*)ret + sizeof(tURI); memcpy(ret->Proto, String, protolen); @@ -140,14 +140,8 @@ tURI *URI_Parse(const char *String) else ret->Path = ret->Host + hostlen + 1; - tmp ++; pathlen = 0; - while(*tmp) - { - ret->Path[pathlen] = *tmp; - tmp ++; - pathlen ++; - } + strcpy(ret->Path, tmp); return ret; }