Age | Commit message (Collapse) | Author | Files | Lines |
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libice/-/merge_requests/25>
|
|
Will cause -Wdiscarded-qualifiers warnings unless built with
xtrans commit e69d45306f3836 or later (included in xtrans 1.6.0).
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libice/-/merge_requests/25>
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Clears warning from clang 13:
process.c:1612:21: warning: variable 'authDataLen' may be uninitialized
when used here [-Wconditional-uninitialized]
if (authData && authDataLen > 0)
^~~~~~~~~~~
process.c:1344:22: note: initialize the variable 'authDataLen' to
silence this warning
int authDataLen;
^
= 0
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libice/-/merge_requests/23>
|
|
Clears 71 warnings from clang 13 of the form:
connect.c:351:39: warning: empty expression statement has no effect;
remove unnecessary ';' to silence this warning [-Wextra-semi-stmt]
STORE_STRING (pData, IceVendorString);
^
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libice/-/merge_requests/23>
|
|
In function _IceErrorSetupFailed at line no 188, IceAllocScratch is used to
allocate memory for variable pStart and pBuf.
IceAllocScratch is using malloc for memory allocation, malloc can return
NULL on failure. So before dereferencing pStart and pBuf, NULL check must
apply.
v2 (by alanc): correct inverted tests for NULL from original patch
Closes: #5
Signed-off-by: mahendra <mahendra.n@samsung.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libice/-/merge_requests/22>
|
|
In C23 and earlier, it is undefined behavior to call fwrite() with a
NULL pointer, even if the size to copy is zero bytes.
Closes: #11
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libice/-/merge_requests/21>
|
|
In C23 and earlier, it is undefined behavior to call memcpy() with a
NULL pointer, even if the size to copy is zero bytes.
Closes: #10
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libice/-/merge_requests/20>
|
|
Clears warning from gcc 14.1:
register.c: In function ‘IceRegisterForProtocolSetup’:
register.c:92:15: warning: dereference of possibly-NULL ‘p’ [CWE-690]
[-Wanalyzer-possible-null-dereference]
92 | p->vendor = strdup(vendor);
| ~~~~~~~~~~^~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libice/-/merge_requests/19>
|
|
Clears warning from gcc 14.1:
protosetup.c: In function ‘IceProtocolSetup’:
protosetup.c:178:24: warning: dereference of NULL ‘authIndices’ [CWE-476]
[-Wanalyzer-null-dereference]
178 | authIndices[i]]);
| ~~~~~~~~~~~^~~
ICElibint.h:179:36: note: in definition of macro ‘STORE_STRING’
179 | CARD16 _len = (CARD16) strlen (_string); \
| ^~~~~~~
‘IceProtocolSetup’: events 1-8
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libice/-/merge_requests/19>
|
|
Clears warning from gcc 14.1:
process.c: In function ‘ProcessProtocolSetup’:
process.c:1956:56: warning: use of NULL ‘protocolName’ where non-null
expected [CWE-476] [-Wanalyzer-null-argument]
1956 | if (iceConn->process_msg_info[i].in_use && strcmp (protocolName,
| ^~~~~~~~~~~~~~~~~~~~
1957 | iceConn->process_msg_info[i].protocol->protocol_name) == 0)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libice/-/merge_requests/19>
|
|
Clears warning from gcc 14.1:
process.c: In function ‘ProcessConnectionSetup’:
ICElibint.h:233:13: warning: dereference of possibly-NULL ‘hisAuthNames’
[CWE-690] [-Wanalyzer-possible-null-dereference]
233 | _string = malloc (_len + 1); \
ICElibint.h:247:9: note: in expansion of macro ‘EXTRACT_STRING’
247 | EXTRACT_STRING (_pBuf, _swap, _strings[_i]); \
| ^~~~~~~~~~~~~~
process.c:947:9: note: in expansion of macro ‘EXTRACT_LISTOF_STRING’
947 | EXTRACT_LISTOF_STRING (pData, swap, hisAuthCount, hisAuthNames);
| ^~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libice/-/merge_requests/19>
|
|
The IceReadCompleteMessage() macro may try to malloc() a buffer and
assign it to the final argument.
Clears up 12 -Wanalyzer-null-dereference warnings from gcc 14.1
of the form:
process.c: In function ‘ProcessError’:
ICElibint.h:214:10: warning: dereference of NULL ‘pStart’ [CWE-476]
[-Wanalyzer-null-dereference]
214 | _val = *((CARD16 *) _pBuf); \
| ^
ICElibint.h:232:5: note: in expansion of macro ‘EXTRACT_CARD16’
232 | EXTRACT_CARD16 (_pBuf, _swap, _len); \
| ^~~~~~~~~~~~~~
process.c:689:17: note: in expansion of macro ‘EXTRACT_STRING’
689 | EXTRACT_STRING (pData, swap, temp);
| ^~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libice/-/merge_requests/19>
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libice/-/merge_requests/19>
|
|
Clears warning from gcc 14.1:
misc.c: In function ‘_IceAddOpcodeMapping’:
misc.c:435:9: warning: use of possibly-NULL ‘*iceConn.process_msg_info’
where non-null expected [CWE-690] [-Wanalyzer-possible-null-argument]
435 | memcpy (iceConn->process_msg_info, oldVec,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
436 | oldsize * sizeof (_IceProcessMsgInfo));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libice/-/merge_requests/19>
|
|
Fixes several warnings from gcc 14.1 of the form:
In file included from error.c:33:
error.c: In function ‘_IceDefaultErrorHandler’:
ICElibint.h:234:5: warning: use of possibly-NULL ‘estr’ where non-null
expected [CWE-690] [-Wanalyzer-possible-null-argument]
234 | memcpy (_string, _pBuf, _len); \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error.c:515:13: note: in expansion of macro ‘EXTRACT_STRING’
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libice/-/merge_requests/19>
|
|
Fixes warning from gcc 14.1:
connect.c: In function ‘ConnectToPeer’:
connect.c:541:9: warning: use of possibly-NULL ‘address’ where non-null
expected [CWE-690] [-Wanalyzer-possible-null-argument]
541 | strncpy (address, ptr, len);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libice/-/merge_requests/19>
|
|
Fixes warning from gcc 14.1 in cases where the connection was closed
and iceConn set to NULL on a previous time through the loop.
connect.c: In function ‘IceOpenConnection’:
connect.c:439:51: warning: dereference of NULL ‘iceConn’ [CWE-476]
[-Wanalyzer-null-dereference]
439 | iceConn->my_ice_version_index =
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
440 | reply.connection_reply.version_index;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libice/-/merge_requests/19>
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Current template fails to rebuild the CI container with the current
Debian stable release (a new release since the last update)
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
AC_PROG_LIBTOOL was replaced by LT_INIT in libtool 2 in 2008,
so it's time to rely on it.
Clears autoconf warnings:
configure.ac:18: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
configure.ac:18: You should run autoupdate.
aclocal.m4:3640: AC_PROG_LIBTOOL is expanded from...
configure.ac:18: the top level
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Signed-off-by: Matt Turner <mattst88@gmail.com>
|
|
Commit 0269c687e954db7aca2a4344e32cb203315a00b6 added a static_assert helper
that gets defined to blank if left undefined by assert.h. As this is not a
macro in other languages that use this header, this can lead to a compile-time
error.
Bug: https://bugs.gentoo.org/884369
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
The only files libICE operates on are .ICEauthority files, which
it only uses internally and does not make available to other code,
so there is no concern about ABI mismatch here.
While .ICEauthority files should never be more than 2gb in size,
they may be stored on filesystems with large inodes.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Fixes: b9411f7 ("ice.pc.in: add -lbsd flags when required")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Some implementations of static_assert() define a new variable.
Avoid warnings from those when calling static_assert() from a
macro that may not be at the top of a new code block.
../../src/accept.c: In function 'IceAcceptConnection':
../../src/accept.c:159:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
159 | IceGetHeader (iceConn, 0, ICE_ByteOrder,
| ^~~~~~~~~~~~
../../src/connect.c: In function 'IceOpenConnection':
../../src/connect.c:254:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
254 | IceGetHeader (iceConn, 0, ICE_ByteOrder,
| ^~~~~~~~~~~~
../../src/connect.c:340:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
340 | IceGetHeaderExtra (iceConn, 0, ICE_ConnectionSetup,
| ^~~~~~~~~~~~~~~~~
[...etc...]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Avoid unnecessary library dependency when using a libc with these
functions included
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
This is the preferred usage form for libbsd, as it makes the code more
portable and requires no special includes for libbsd, by transparently
injects the needed standard headers that would be used on a BSD.
Signed-off-by: Guillem Jover <guillem@hadrons.org>
|
|
Fixes numerous gcc warnings of the form:
connect.c: In function ‘IceOpenConnection’:
ICElibint.h:160:25: warning: potential null pointer dereference [-Wnull-dereference]
*((CARD16 *) _pBuf) = _val; \
^
ICElibint.h:174:5: note: in expansion of macro ‘STORE_CARD16’
STORE_CARD16 (_pBuf, _len); \
^~~~~~~~~~~~
connect.c:351:5: note: in expansion of macro ‘STORE_STRING’
STORE_STRING (pData, IceReleaseString);
^~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
A message header length larger than ICE_OUTBUFSIZE will cause
buffer overflows.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
It should never happen, but has been possible in the past when
we didn't handle buffer checks properly - this would help us
catch it if a similar mistake ever happens again (or the wrong
memory pointer gets corrupted by something else).
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Reduce duplicated code in _IceRead() and _IceWrite()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
If there's not room for it in the buffer, we already set pData to
NULL, but still set the outbufptr to include the space, which could
lead to IceFlush() reading past the end of the buffer.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Signed-off-by: Walter Harms <wharms@bfs.de>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
fix a potential null pointer deference error
Signed-off-by: Walter Harms <wharms@bfs.de>
|
|
In function 'IceOpenConnection': gcc give the following warning:
connect.c:106:11: warning: declaration of 'iceConn' shadows a previous local [-Wshadow]
fixed by renaming 2. iceConn to iConn (and all its uses)
Signed-off-by: Walter Harms <wharms@bfs.de>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Fixes gcc complaint:
process.c: In function ‘ProcessAuthReply’:
process.c:1478:20: warning: declaration of ‘status’ shadows a previous local [-Wshadow]
1478 | Status status = 1;
| ^~~~~~
process.c:1426:25: note: shadowed declaration is here
1426 | IcePaAuthStatus status =
| ^~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
This resolves an issue reported by the Oracle Parfait static analyzer:
Error: Use after free
Use after free [use-after-free] (CWE 416):
Use after free of pointer trans_conn
at line 566 of lib/libICE/src/connect.c in function 'ConnectToPeer'.
trans_conn previously freed with _IceTransClose at line 532
trans_conn was allocated at line 525 with _IceTransOpenCOTSClient
even though I believe this is already handled by the
'if (madeConnection) { ... } else trans_conn = NULL;'
block, but the analyzer apparently doesn't follow that logic,
while this simple change makes it obvious.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
If we're going to link to libbsd, might as well use it for strlcpy too
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Found by using:
codespell --builtin clear,rare,usage,informal,code,names
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
|
|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
Assigning and testing a value in a single statement hinders code clarity
and may confuses static code analyzers.
Separate the assignment and the test for clarity.
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
|
|
`_IceRead()` gets called from multiple places which do not expect the
connection to be freed.
Do not free the connection data in `_IceRead()` to avoid potential
use-after-free issue in the various callers.
The connection data will be freed eventually in `ProcessWantToClose()`,
so not freeing it in `_IceRead()` should not introduce an memory leak.
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
|
|
The function `_IceTransMakeAllCOTSServerListeners` allocates memory for
`transConns` which is leaked in case of error.
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
|