aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2021-02-28 06:57:46 +0000
committerTatsuya Kinoshita <tats@debian.org>2021-02-28 07:28:03 +0000
commit7bd52f97a306237fe0795e8b42241e7813092785 (patch)
tree0d71938c9fd07872beef3e9ec6d341397fb01739
parentPrevent unintentional integer overflow in Strcat_charp_n (diff)
downloadw3m-0.5.3+git20210102+deb11u0.4.tar.gz
w3m-0.5.3+git20210102+deb11u0.4.zip
Prevent unintentional integer overflow in libwcv0.5.3+git20210102+deb11u0.4
-rw-r--r--libwc/utf7.c2
-rw-r--r--libwc/utf8.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/libwc/utf7.c b/libwc/utf7.c
index 44a3330..874bc3d 100644
--- a/libwc/utf7.c
+++ b/libwc/utf7.c
@@ -73,7 +73,7 @@ wc_conv_from_utf7(Str is, wc_ces ces)
;
if (p == ep)
return is;
- os = Strnew_size(is->length * 4 / 3);
+ os = Strnew_size(is->length + is->length / 3);
if (p > sp)
Strcat_charp_n(os, is->ptr, (int)(p - sp));
diff --git a/libwc/utf8.c b/libwc/utf8.c
index e523139..c878499 100644
--- a/libwc/utf8.c
+++ b/libwc/utf8.c
@@ -150,7 +150,7 @@ wc_conv_from_utf8(Str is, wc_ces ces)
;
if (p == ep)
return is;
- os = Strnew_size(is->length * 4 / 3);
+ os = Strnew_size(is->length + is->length / 3);
if (p > sp)
Strcat_charp_n(os, is->ptr, (int)(p - sp));