diff options
Diffstat (limited to 'src/locale/localed-util.c')
-rw-r--r-- | src/locale/localed-util.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/locale/localed-util.c b/src/locale/localed-util.c index ddca11d908..4f2d3aaeb8 100644 --- a/src/locale/localed-util.c +++ b/src/locale/localed-util.c @@ -505,7 +505,9 @@ int find_legacy_keymap(Context *c, char **ret) { /* If that didn't work, strip off the * other layouts from the entry, too */ - x = strndup(a[1], strcspn(a[1], ",")); + x = strdupcspn(a[1], ","); + if (!x) + return -ENOMEM; if (startswith_comma(c->x11_layout, x)) matching = 1; } |