X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=filematch.c;h=0837136f7e36bcea5d6d8821a5bec224d58070ef;hp=ca0969ce9eff01131e2b678077ead274e1f5b669;hb=16742571f9a7d696a654668febdc10b4f4affd57;hpb=aa33d8f8642530f7f266d6cde1422f95aa74b2be diff --git a/filematch.c b/filematch.c index ca0969ce..0837136f 100644 --- a/filematch.c +++ b/filematch.c @@ -3,7 +3,7 @@ // LordHavoc: some portable directory listing code I wrote for lmp2pcx, now used in darkplaces to load id1/*.pak and such... -int matchpattern(char *in, char *pattern, int caseinsensitive) +int matchpattern(const char *in, const char *pattern, int caseinsensitive) { int c1, c2; while (*pattern) @@ -61,10 +61,13 @@ int matchpattern(char *in, char *pattern, int caseinsensitive) stringlist_t *stringlistappend(stringlist_t *current, char *text) { stringlist_t *newitem; - newitem = (stringlist_t *)Z_Malloc(strlen(text) + 1 + sizeof(stringlist_t)); + size_t textlen; + + textlen = strlen(text) + 1; + newitem = (stringlist_t *)Z_Malloc(textlen + sizeof(stringlist_t)); newitem->next = NULL; newitem->text = (char *)(newitem + 1); - strcpy(newitem->text, text); + memcpy(newitem->text, text, textlen); if (current) current->next = newitem; return newitem;