Last active
November 7, 2016 15:24
-
-
Save fvandepitte/ec28f4321a48061808d0095853af7bd7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
int main () | |
{ | |
char* path = "/Users/user/test/tëst/test"; //Sent by the system | |
char* wp = "/Users/user/test/tëst"; //Some path we claim to be ours | |
size_t wp_len = strlen(wp); | |
if (strncmp (wp,path,wp_len) == 0) //Check is path is a subpath | |
{ | |
printf ("matched %s\n", path); | |
}else { | |
printf ("could not match\n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment