libidav/utils.c

changeset 757
7ced4052e8ca
parent 747
efbd59642577
child 775
e5909dff0dbf
--- a/libidav/utils.c	Sun Jun 11 21:23:45 2023 +0200
+++ b/libidav/utils.c	Sun Jun 11 21:30:11 2023 +0200
@@ -459,7 +459,7 @@
                 cxstring seg = cx_strn(seg_ptr, seg_len);
                 if(!cx_strcmp(seg, CX_STR(".."))) {
                     for(int j=buf.pos;j>=0;j--) {
-                        char t = buf.space[j];
+                        char t = j < buf.pos ? buf.space[j] : 0;
                         if(IS_PATH_SEPARATOR(t) || j == 0) {
                             buf.pos = j;
                             buf.size = j;

mercurial