From: Ran Benita Date: Sun, 1 Apr 2012 13:51:48 +0000 (+0300) Subject: Add a NULL check before before strcmp'ing X-Git-Tag: xkbcommon-0.2.0~664 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=84ec6b61a76a753f72eecec825fd0736d5b0070c;p=platform%2Fupstream%2Flibxkbcommon.git Add a NULL check before before strcmp'ing The names array can have NULL entries for some virtual modifier indexes. Signed-off-by: Ran Benita --- diff --git a/src/xkbcomp/vmod.c b/src/xkbcomp/vmod.c index 799185d..1a9d43d 100644 --- a/src/xkbcomp/vmod.c +++ b/src/xkbcomp/vmod.c @@ -242,7 +242,8 @@ ResolveVirtualModifier(ExprDef * def, struct xkb_desc *xkb, const char *name = XkbcAtomText(def->value.str); for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { - if ((info->available & bit) && strcmp(names->vmods[i], name) == 0) + if ((info->available & bit) && names->vmods[i] && + strcmp(names->vmods[i], name) == 0) { val_rtrn->uval = i; return True;