aboutsummaryrefslogtreecommitdiffstats
path: root/table.c
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2016-12-10 08:32:49 +0000
committerTatsuya Kinoshita <tats@debian.org>2016-12-10 09:18:58 +0000
commitf763b8ebf5441cb44d2c0234565fadd5eb1c87a5 (patch)
tree4c32cbca1c4507c3d6a5468f3cc293ee32622e2d /table.c
parentPrevent overflow beyond the end of string for wtf to wcs macros (diff)
downloadw3m-f763b8ebf5441cb44d2c0234565fadd5eb1c87a5.tar.gz
w3m-f763b8ebf5441cb44d2c0234565fadd5eb1c87a5.zip
Prevent overflow beyond the end of string in visible_length_plain()
Bug-Debian: https://github.com/tats/w3m/issues/76
Diffstat (limited to 'table.c')
-rw-r--r--table.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/table.c b/table.c
index e996570..5c41c89 100644
--- a/table.c
+++ b/table.c
@@ -510,8 +510,9 @@ int
visible_length_plain(char *str)
{
int len = 0, max_len = 0;
+ char *strz = str + strlen(str);
- while (*str) {
+ while (str < strz) {
if (*str == '\t') {
do {
len++;