File libslirp-CVE-2021-3594.patch of Package libslirp.25314

Index: libslirp-4.3.1/src/udp.c
===================================================================
--- libslirp-4.3.1.orig/src/udp.c	2020-07-08 13:48:02.000000000 +0200
+++ libslirp-4.3.1/src/udp.c	2022-02-23 09:47:40.471642451 +0100
@@ -93,7 +93,10 @@ void udp_input(register struct mbuf *m,
     /*
      * Get IP and UDP header together in first mbuf.
      */
-    ip = mtod(m, struct ip *);
+    ip = mtod_check(m, iphlen + sizeof(struct udphdr));
+    if (ip == NULL) {
+        goto bad;
+    }
     uh = (struct udphdr *)((char *)ip + iphlen);
 
     /*
openSUSE Build Service is sponsored by