OSDN Git Service

android/hal: Fix crash while receiving notification
authorSzymon Janc <szymon.janc@tieto.com>
Wed, 23 Oct 2013 13:46:23 +0000 (15:46 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Wed, 23 Oct 2013 16:32:16 +0000 (19:32 +0300)
This fix following crash:
Invalid read of size 8
   at 0x408B33: notification_handler (hal-ipc.c:122)
   by 0x4E39E99: start_thread (pthread_create.c:308)
 Address 0x8 is not stack'd, malloc'd or (recently) free'd

android/hal-ipc.c

index e8bba11..97a3d29 100644 (file)
@@ -118,7 +118,7 @@ static void *notification_handler(void *data)
                fd = -1;
 
                /* Receive auxiliary data in msg */
-               for (cmsg = CMSG_FIRSTHDR(&msg); !cmsg;
+               for (cmsg = CMSG_FIRSTHDR(&msg); cmsg;
                                        cmsg = CMSG_NXTHDR(&msg, cmsg)) {
                        if (cmsg->cmsg_level == SOL_SOCKET
                                        && cmsg->cmsg_type == SCM_RIGHTS) {