diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-04-28 16:20:09 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-05-06 17:47:11 -0700 |
commit | 4a1b2330ff2589c3c56159f3113710950d41b39b (patch) | |
tree | 78645c748c41a1e0933ab3b572577595301a07f5 /os | |
parent | 36e461f8b3cfc7133801ec95ca31a363819ed91a (diff) |
WriteToClient: handle allocation failure
os/io.c: In function ‘write_to_client_internal’:
os/io.c:562:5: warning: use of possibly-NULL ‘buf’ where non-null expected
[CWE-690] [-Wanalyzer-possible-null-argument]
562 | memmove( (char *) oco->buf + oco->count, buf, count);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/app/xfs/-/merge_requests/7>
Diffstat (limited to 'os')
-rw-r--r-- | os/io.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -580,8 +580,10 @@ WriteToClient(ClientPtr client, int count, char *buf) if (NULL == buf) { flag = -1; buf = (char *) FScalloc(1, count); + if (buf == NULL) + FatalError("WriteToClient couldn't create client buffer\n"); } - write_to_client_internal(client, count, buf, padlength[count & 3]); + write_to_client_internal(client, count, buf, padlength[count & 3]); if (flag) FSfree(buf); } |