Prevent unintentional integer overflow in libwc
This commit is contained in:
@@ -73,7 +73,7 @@ wc_conv_from_utf7(Str is, wc_ces ces)
|
|||||||
;
|
;
|
||||||
if (p == ep)
|
if (p == ep)
|
||||||
return is;
|
return is;
|
||||||
os = Strnew_size(is->length * 4 / 3);
|
os = Strnew_size(is->length + is->length / 3);
|
||||||
if (p > sp)
|
if (p > sp)
|
||||||
Strcat_charp_n(os, is->ptr, (int)(p - sp));
|
Strcat_charp_n(os, is->ptr, (int)(p - sp));
|
||||||
|
|
||||||
|
@@ -150,7 +150,7 @@ wc_conv_from_utf8(Str is, wc_ces ces)
|
|||||||
;
|
;
|
||||||
if (p == ep)
|
if (p == ep)
|
||||||
return is;
|
return is;
|
||||||
os = Strnew_size(is->length * 4 / 3);
|
os = Strnew_size(is->length + is->length / 3);
|
||||||
if (p > sp)
|
if (p > sp)
|
||||||
Strcat_charp_n(os, is->ptr, (int)(p - sp));
|
Strcat_charp_n(os, is->ptr, (int)(p - sp));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user