From 5004ef0b757c1cd7e4ceaa1759914f938d5ea295 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sun, 3 Apr 2005 18:24:25 +0000 Subject: Bug #1447: Fix a use-after-free case in libSM. (Mark McLoughlin) --- src/sm_process.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/sm_process.c b/src/sm_process.c index 8f913f0..c770236 100644 --- a/src/sm_process.c +++ b/src/sm_process.c @@ -481,6 +481,7 @@ Bool swap; smRegisterClientMsg *pMsg; char *pData, *pStart; char *previousId; + int idLen; #if 0 /* No-op */ CHECK_AT_LEAST_SIZE (iceConn, _SmsOpcode, opcode, @@ -506,7 +507,7 @@ Bool swap; pData = pStart; - EXTRACT_ARRAY8_AS_STRING (pData, swap, previousId); + EXTRACT_ARRAY8 (pData, swap, idLen, previousId); if (*previousId == '\0') { @@ -521,11 +522,8 @@ Bool swap; * The previoudId was bad. Generate BadValue error. */ - int length = previousId ? strlen (previousId) : 0; - int bytes = ARRAY8_BYTES (length); - _IceErrorBadValue (smsConn->iceConn, _SmsOpcode, SM_RegisterClient, - 8, bytes, (IcePointer) pStart); + 8, ARRAY8_BYTES (idLen), (IcePointer) pStart); } IceDisposeCompleteMessage (iceConn, pStart); -- cgit v1.2.3