summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2025-08-09 15:43:51 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2025-08-09 15:43:51 -0700
commit0761a37a6111f22e2552f9f2245bddbb6d3db2bf (patch)
tree13605a94c488ffe0a970543544b1227c32e25ee6
parent35e135831743406db39b7319aad6e16cbbd8451e (diff)
parse_keysym: handle possible NULL return from copy_to_scratch()HEADmaster
Handles report from gcc 15.1: handle.c: In function ‘parse_keysym’: handle.c:333:10: warning: use of NULL ‘tmpname’ where non-null expected [CWE-476] [-Wanalyzer-null-argument] 333 | if (!strcmp(*name, "NoSymbol")) { | ^~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/app/xmodmap/-/merge_requests/10>
-rw-r--r--handle.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/handle.c b/handle.c
index a8894e6..524650f 100644
--- a/handle.c
+++ b/handle.c
@@ -330,6 +330,8 @@ static Bool
parse_keysym(const char *line, int n, char **name, KeySym *keysym)
{
*name = copy_to_scratch (line, n);
+ if (*name == NULL)
+ return (False);
if (!strcmp(*name, "NoSymbol")) {
*keysym = NoSymbol;
return (True);