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:
parent
a297cf8676
commit
d319fe14f0
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user