File: fixpath.c

package info (click to toggle)
tlswrapper 0~20241101-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,796 kB
  • sloc: ansic: 7,099; sh: 2,342; makefile: 234
file content (20 lines) | stat: -rw-r--r-- 390 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "fixpath.h"

/* for security reasons the 'fixpath(s)' function replaces '/.' -> '/:' */

void fixpath(char *s) {

    char ch;
    unsigned long long i, j;

    j = 0;
    for (i = 0; s[i];   i) {
        ch = s[i];
        if (j && (s[j - 1] == '/')) {
            if (ch == '.') ch = ':';
            if (ch == '/') continue;
        }
        s[j  ] = ch;
    }
    s[j] = 0;
}