summaryrefslogtreecommitdiff
path: root/src/sm_manager.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-09-07 12:44:33 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-04 12:26:26 -0800
commit12812dca0f852178d8cc3813e4056b396a8f3ab5 (patch)
tree193d492c468ad6cbca1c7d50142555ea15f97c00 /src/sm_manager.c
parentbb02359ff464d51cbb29d3c93e7e55f3649e5b91 (diff)
downloadxorg-lib-libSM-12812dca0f852178d8cc3813e4056b396a8f3ab5.tar.gz
Handle arrays too large to fit in iceConn buffers
Fixes numerous gcc warnings of the form: sm_client.c: In function ‘SmcOpenConnection’: SMlibint.h:109:25: warning: potential null pointer dereference [-Wnull-dereference] *((CARD32 *) _pBuf) = _val; \ SMlibint.h:160:5: note: in expansion of macro ‘STORE_CARD32’ STORE_CARD32 (_pBuf, (CARD32) _len); \ ^~~~~~~~~~~~ sm_client.c:207:5: note: in expansion of macro ‘STORE_ARRAY8’ STORE_ARRAY8 (pData, len, previousId); ^~~~~~~~~~~~ v2: Raise required libICE version to 1.1.0 to get the updated IceGetHeaderExtra macro definition needed for this to work correctly. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src/sm_manager.c')
-rw-r--r--src/sm_manager.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/sm_manager.c b/src/sm_manager.c
index 7d0e583..81e7d2f 100644
--- a/src/sm_manager.c
+++ b/src/sm_manager.c
@@ -198,9 +198,13 @@ SmsRegisterClientReply(SmsConn smsConn, char *clientId)
SIZEOF (smRegisterClientReplyMsg), WORD64COUNT (extra),
smRegisterClientReplyMsg, pMsg, pData);
- STORE_ARRAY8 (pData, strlen (clientId), clientId);
-
- IceFlush (iceConn);
+ if (pData != NULL) {
+ STORE_ARRAY8 (pData, strlen (clientId), clientId);
+ IceFlush (iceConn);
+ }
+ else {
+ SEND_ARRAY8 (iceConn, strlen (clientId), clientId);
+ }
return (1);
}