diff options
| author | Tatsuya Kinoshita <tats@debian.org> | 2016-12-13 13:24:54 +0000 | 
|---|---|---|
| committer | Tatsuya Kinoshita <tats@debian.org> | 2016-12-13 13:24:54 +0000 | 
| commit | 77d8d8d6576d8afc0f6b2e09bb88c7ca9dba58bb (patch) | |
| tree | 80cf858a29eca702d926d02992dfe7c72bb2e51e | |
| parent | Preserve one byte for end of string character in form_update_line() (diff) | |
| download | w3m-77d8d8d6576d8afc0f6b2e09bb88c7ca9dba58bb.tar.gz w3m-77d8d8d6576d8afc0f6b2e09bb88c7ca9dba58bb.zip | |
Prevent overflow beyond the end of string in textfieldrep()
Bug-Debian: https://github.com/tats/w3m/issues/79
Diffstat (limited to '')
| -rw-r--r-- | form.c | 2 | 
1 files changed, 2 insertions, 0 deletions
| @@ -526,6 +526,8 @@ textfieldrep(Str s, int width)      for (i = 0; i < s->length; i += c_len) {  	c_type = get_mctype((unsigned char *)&s->ptr[i]);  	c_len = get_mclen(&s->ptr[i]); +	if (i + c_len > s->length) +	    break;  	if (s->ptr[i] == '\r')  	    continue;  	k = j + get_mcwidth(&s->ptr[i]); | 
