mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2026-08-02 23:37:06 +00:00
In case KEY_BACKSPACE / KEY_DC to delete a char, it memmove only
(len-cursor_position+1) bytes;
the default case is to insert a char, it should also memmove exactly
(len-cursor_position+1) bytes;
the original use of (len+1) is wrong and may access following memory
that doesn't belong to result, may cause SegFault in theory;
case KEY_BACKSPACE:
if (cursor_position > 0) {
memmove(&result[cursor_position-1],
&result[cursor_position],
len-cursor_position+1);
cursor_position--;
}
break;
case KEY_DC:
if (cursor_position >= 0 && cursor_position < len) {
memmove(&result[cursor_position],
&result[cursor_position+1],
len-cursor_position+1);
}
break;
default:
if ((isgraph(res) || isspace(res)) &&
len-2 < result_len) {
/* insert the char at the proper position */
memmove(&result[cursor_position+1],
&result[cursor_position],
len-cursor_position+1);
result[cursor_position] = res;
cursor_position++;
}
Signed-off-by: Cheng Renquan <crquan@gmail.com>
Acked-by: Nir Tzachar <nir.tzachar@gmail.com>
|
||
|---|---|---|
| .. | ||
| lxdialog | ||
| .gitignore | ||
| check.sh | ||
| conf.c | ||
| confdata.c | ||
| expr.c | ||
| expr.h | ||
| gconf.c | ||
| gconf.glade | ||
| images.c | ||
| kxgettext.c | ||
| lkc_proto.h | ||
| lkc.h | ||
| Makefile | ||
| mconf.c | ||
| menu.c | ||
| nconf.c | ||
| nconf.gui.c | ||
| nconf.h | ||
| POTFILES.in | ||
| qconf.cc | ||
| qconf.h | ||
| streamline_config.pl | ||
| symbol.c | ||
| util.c | ||
| zconf.gperf | ||
| zconf.hash.c_shipped | ||
| zconf.l | ||
| zconf.lex.c_shipped | ||
| zconf.tab.c_shipped | ||
| zconf.y | ||