1 /* safety.c:
2  *
3  ****************************************************************
4  * Copyright (C) 2003 Tom Lord
5  *
6  * See the file "COPYING" for further information about
7  * the copyright and warranty status of this work.
8  */
9 
10 
11 #include "hackerlab/char/char-class.h"
12 #include "hackerlab/char/str.h"
13 #include "tla/libfsutils/safety.h"
14 
15 
16 
17 int
is_non_upwards_relative_path(const t_uchar * path)18 is_non_upwards_relative_path (const t_uchar * path)
19 {
20 
21   if (path && (*path == '/'))
22     return 0;
23 
24   while (path && *path)
25     {
26       if (!str_cmp_prefix ("../", path) || !str_cmp_prefix ("..", path))
27         return 0;
28 
29       path = str_chr_index (path, '/');
30       if (path)
31         ++path;
32     }
33 
34   return 1;
35 }
36 
37 
38 
39 
40 
41 /* tag: Tom Lord Fri May 30 00:42:45 2003 (safety.c)
42  */
43