#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
#include <errno.h>
#include <sys/socket.h>
#include <fcntl.h>
pid_t pid = -1;
while (cmsgp != NULL) {
if (cmsgp->cmsg_type == SCM_CREDENTIALS) {
- assert(cmsgp->cmsg_len ==
- CMSG_LEN(sizeof(struct ucred)));
- assert(cmsgp->cmsg_level == SOL_SOCKET);
+ if (
+ cmsgp->cmsg_len != CMSG_LEN(sizeof(struct ucred)) ||
+ cmsgp->cmsg_level != SOL_SOCKET
+ ) {
+ printf("[notify_socket] invalid cmsg data, ignoring\n");
+ Py_RETURN_NONE;
+ }
struct ucred cred;
memcpy(&cred, CMSG_DATA(cmsgp), sizeof(cred));
}
return m;
-}
\ No newline at end of file
+}