1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

string: fix a one byte leak in .substr()

This commit is contained in:
Alexander Medvednikov 2020-12-11 05:12:18 +01:00
parent a297cf8676
commit d319fe14f0

View File

@ -592,6 +592,9 @@ pub fn (s string) substr(start int, end int) string {
}
}
len := end - start
if len == s.len {
return s.clone()
}
mut res := string{
str: malloc(len + 1)
len: len