[kbd] Invalid out of bounds memory read when running make check

Alexey Gladkov gladkov.alexey at gmail.com
Sat Apr 2 19:36:15 MSK 2016


On Sun, Mar 27, 2016 at 08:59:22PM +0100, Felix Janda wrote:
> Subject: ksyms: Fix out of bounds memory read in codetoksym
> 
> Bug detected by Hanno Böck using asan.
> ---
>  src/libkeymap/ksyms.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/libkeymap/ksyms.c b/src/libkeymap/ksyms.c
> index 22b1336..3d35ead 100644
> --- a/src/libkeymap/ksyms.c
> +++ b/src/libkeymap/ksyms.c
> @@ -197,7 +197,7 @@ codetoksym(struct lk_ctx *ctx, int code) {
>  		i = ctx->charset;
>  		while (1) {
>  			p = (sym *) charsets[i].charnames;
> -			if (p) {
> +			if (p && (KVAL(code) >= charsets[i].start)) {
>  				p += KVAL(code) - charsets[i].start;
>  
>  				if (p->name[0])
> -- 
> 2.7.3

Applied, thanks!

-- 
Rgrds, legion



More information about the kbd mailing list