diff options
author | Tatsuya Kinoshita <tats@debian.org> | 2016-12-15 13:42:12 +0000 |
---|---|---|
committer | Tatsuya Kinoshita <tats@debian.org> | 2016-12-15 13:42:12 +0000 |
commit | 2aa21dc3286c605c3524bd4887614441db116296 (patch) | |
tree | eedc1735fc5062d92182ccd30605b22d6d4db0dc | |
parent | Update ChangeLog (diff) | |
download | w3m-2aa21dc3286c605c3524bd4887614441db116296.tar.gz w3m-2aa21dc3286c605c3524bd4887614441db116296.zip |
Revert "Prevent overflow beyond the end of string in proc_mchar()"
This reverts commit e79d0ec2a00369a6af24007a1f2bb5e876e2c847.
Diffstat (limited to '')
-rw-r--r-- | file.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -2603,20 +2603,19 @@ static void proc_mchar(struct readbuffer *obuf, int pre_mode, int width, char **str, Lineprop mode) { - int len, slen; + size_t len; check_breakpoint(obuf, pre_mode, *str); obuf->pos += width; - len = get_mclen(*str); - slen = (int)strlen(*str); - if (len > slen && slen > 0) - len = slen; - Strcat_charp_n(obuf->line, *str, len); + Strcat_charp_n(obuf->line, *str, get_mclen(*str)); if (width > 0) { set_prevchar(obuf->prevchar, *str, 1); if (**str != ' ') obuf->prev_ctype = mode; } + len = get_mclen(*str); + if (len > strlen(*str)) + len = strlen(*str); (*str) += len; obuf->flag |= RB_NFLUSHED; } |