[kbd] [PATCH] libkeymap: Fix mk_mapname for the plain map

Alexey Gladkov gladkov.alexey at gmail.com
Sun Feb 23 20:36:39 MSK 2020

On Fri, Dec 06, 2019 at 03:58:03PM +0000, Javier Pello García wrote:
> mk_mapname did not correctly return "plain" for the plain map
> (no modifier set) if it had already been called, as it did not
> correctly reset the static buffer that it uses for the map name.
> When mk_mapname is called for the first time from the first loop
> in lk_dump_ctable, all is fine, since buf has not been used yet
> and it is initialised to 0. However, when it is called again for
> the plain map from the second loop in lk_dump_ctable, buf already
> contains a value (left over from the last iteration in the first
> loop), and then strcat appends "plain" to that value instead of
> overwriting it, resulting in a bogus value.

Thanks for report. To fix this, it is enough to replace strcat with
strcpy. Fixed. Thanks!

Rgrds, legion

More information about the kbd mailing list