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

builtin: do not use unsafe sprintf/vsprintf functions

This commit is contained in:
radare
2020-03-21 06:37:58 +01:00
committed by GitHub
parent 7e139b5384
commit c21e976cad
4 changed files with 140 additions and 47 deletions

View File

@ -42,7 +42,7 @@ pub fn parse_rfc2822(s string) ?Time {
mm := pos / 3 + 1
mut tmstr := byteptr(0)
unsafe { tmstr = malloc(s.len * 2) }
count := C.sprintf(charptr(tmstr), '%s-%02d-%s %s', fields[3].str, mm,
count := C.snprintf(charptr(tmstr), (s.len * 2), '%s-%02d-%s %s', fields[3].str, mm,
fields[1].str, fields[4].str)
t := parse(tos(tmstr, count)) or {