sms: Only copy when there is actual data
authorPaul Kocialkowski <contact@paulk.fr>
Sat, 26 Jul 2014 16:50:01 +0000 (18:50 +0200)
committerPaul Kocialkowski <contact@paulk.fr>
Sat, 26 Jul 2014 16:50:01 +0000 (18:50 +0200)
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
samsung-ipc/sms.c

index e06890f..f0e2925 100644 (file)
@@ -109,8 +109,10 @@ void *ipc_sms_save_msg_setup(struct ipc_sms_save_msg_request_header *header,
     memcpy(p, &smsc_length, sizeof(smsc_length));
     p += sizeof(smsc_length);
 
-    memcpy(p, smsc, smsc_size);
-    p += smsc_size;
+    if (smsc != NULL && smsc_size > 0) {
+        memcpy(p, smsc, smsc_size);
+        p += smsc_size;
+    }
 
     memcpy(p, pdu, pdu_size);
     p += pdu_size;