]> git.saurik.com Git - apple/launchd.git/blobdiff - src/log.c
launchd-842.92.1.tar.gz
[apple/launchd.git] / src / log.c
index 1bd8b4906b1114ba9ef2a643beec6c7cf71494f0..95a29ff6fecf41efc62350f9cc9d410e9c15da0d 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -347,6 +347,11 @@ launchd_log_forward(uid_t forward_uid, gid_t forward_gid, vm_offset_t inval, mac
                        break;
                }
 
+               if (lm_walk->obj_sz < sizeof(struct logmsg_s)) {
+                       launchd_syslog(LOG_WARNING, "Received bytes %llu are less than expected bytes %lu.", lm_walk->obj_sz, sizeof(struct logmsg_s));
+                       break;
+               }
+
                if (!(lm = malloc(lm_walk->obj_sz))) {
                        launchd_syslog(LOG_WARNING, "Failed to allocate %llu bytes for log message with %u bytes left in forwarded data. Ignoring remaining messages.", lm_walk->obj_sz, data_left);
                        break;