hotfix: fixes possible out of bounds access in ospaths.joinPath

This commit is contained in:
Araq 2018-07-07 02:31:43 +02:00
commit 8667899d53

View file

@ -186,7 +186,7 @@ proc joinPath*(head, tail: string): string {.
if len(head) == 0: if len(head) == 0:
result = tail result = tail
elif head[len(head)-1] in {DirSep, AltSep}: elif head[len(head)-1] in {DirSep, AltSep}:
if tail[0] in {DirSep, AltSep}: if tail.len > 0 and tail[0] in {DirSep, AltSep}:
result = head & substr(tail, 1) result = head & substr(tail, 1)
else: else:
result = head & tail result = head & tail