diff options
author | Joursoir <chat@joursoir.net> | 2021-02-26 16:16:13 +0000 |
---|---|---|
committer | Joursoir <chat@joursoir.net> | 2021-02-26 16:16:13 +0000 |
commit | 3aabad59dc2bbdb74777f2d0dc195fb0bbe75bfc (patch) | |
tree | 7c340979b1f3466b4b78f3c03ac5fd311d617d92 /src/implementation.c | |
parent | a8fe7bce0ea33f71485cf8c2e4c8330831c849ce (diff) | |
download | lock-password-3aabad59dc2bbdb74777f2d0dc195fb0bbe75bfc.tar.gz lock-password-3aabad59dc2bbdb74777f2d0dc195fb0bbe75bfc.tar.bz2 lock-password-3aabad59dc2bbdb74777f2d0dc195fb0bbe75bfc.zip |
improve code and codestyle; mv/rm cmd don't use global vars anymore
Diffstat (limited to 'src/implementation.c')
-rw-r--r-- | src/implementation.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/implementation.c b/src/implementation.c index d8b0973..e499f0a 100644 --- a/src/implementation.c +++ b/src/implementation.c @@ -53,18 +53,13 @@ static void copyText(char *password) } /* check two dot in path */ -int checkForbiddenPaths(char *path) +int check_sneaky_paths(const char *path) { - int i, length; - int firstdot = 0; - for(i = 0, length = strlen(path); i < length; i++) + int length = strlen(path), i; + for(i = 1; i < length; i++) { - if(path[i] == '.') { - if(firstdot) - return 1; - firstdot++; - } - else firstdot = 0; + if(path[i-1] == '.' && path[i] == '.') + return 1; } return 0; } |