--- 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;