public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/openslp] rawhide: Fix reply size truncation in SrvRply, AttrRply and SrvTypeRply
@ 2026-11-09  9:21 Vitezslav Crhonek
  0 siblings, 0 replies; only message in thread
From: Vitezslav Crhonek @ 2026-11-09  9:21 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/openslp
Branch : rawhide
Commit : e2e0f684f7f6696d69baa198348b4a3f765c265f
Author : Vitezslav Crhonek <vcrhonek@redhat.com>
Date   : 2026-11-09T10:21:00+01:00
Stats  : +78/-0 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/openslp/c/e2e0f684f7f6696d69baa198348b4a3f765c265f?branch=rawhide

Log:
Fix reply size truncation in SrvRply, AttrRply and SrvTypeRply

---
diff --git a/openslp-2.0.0-reply-size-truncation.patch b/openslp-2.0.0-reply-size-truncation.patch
new file mode 100644
index 0000000..4dfe966
--- /dev/null
+++ b/openslp-2.0.0-reply-size-truncation.patch
@@ -0,0 +1,72 @@
+diff -up openslp-2.0.0/slpd/slpd_process.c.reply-size-truncation openslp-2.0.0/slpd/slpd_process.c
+--- openslp-2.0.0/slpd/slpd_process.c.reply-size-truncation
++++ openslp-2.0.0/slpd/slpd_process.c
+@@ -65,6 +65,35 @@
+ # include "slp_auth.h"
+ #endif
+ 
++/** The largest message describable by the SLPv2 header length field. */
++#define SLP_MAX_WIRE_LENGTH 0xFFFFFF
++
++/** Verify that a reply can be described by the SLPv2 header length field.
++ *
++ * The length field in the SLPv2 header is only 24 bits wide (RFC 2608
++ * section 8).  A larger reply cannot be represented on the wire: PutUINT24()
++ * would silently truncate the value, and the datagram send path - which
++ * re-reads that length from the header to find packet boundaries - would
++ * then misframe the buffer.  Such replies are dropped instead.
++ *
++ * @param[in] size - The computed size of the reply, in bytes.
++ * @param[in] msgtype - The name of the reply, used for logging.
++ *
++ * @return Zero if the reply fits, or SLP_ERROR_INTERNAL_ERROR if it does not.
++ *
++ * @internal
++ */
++static int CheckReplySize(size_t size, const char * msgtype)
++{
++   if (size > SLP_MAX_WIRE_LENGTH)
++   {
++      SLPDLog("%s of %lu bytes exceeds the maximum SLPv2 message length, "
++            "dropping reply\n", msgtype, (unsigned long)size);
++      return SLP_ERROR_INTERNAL_ERROR;
++   }
++   return 0;
++}
++
+ /** Process an SA SrvRequest message.
+  *
+  * @param[in] message - The message to process.
+@@ -586,6 +615,10 @@ RESPOND:
+       }
+    }
+ 
++   errorcode = CheckReplySize(size, "SrvRply");
++   if (errorcode != 0)
++      goto FINISHED;
++
+    /* reallocate the result buffer */
+    result = SLPBufferRealloc(result, size);
+    if (result == 0)
+@@ -1104,6 +1137,10 @@ RESPOND:
+ 
+    }
+ 
++   errorcode = CheckReplySize(size, "AttrRply");
++   if (errorcode != 0)
++      goto FINISHED;
++
+    /* alloc the  buffer */
+    result = SLPBufferRealloc(result, size);
+    if (result == 0)
+@@ -1305,6 +1342,10 @@ RESPOND:
+    if (errorcode == 0)
+       size += db->srvtypelistlen;
+ 
++   errorcode = CheckReplySize(size, "SrvTypeRply");
++   if (errorcode != 0)
++      goto FINISHED;
++
+    /* Reallocate the result buffer */
+    result = SLPBufferRealloc(result, size);
+    if (result == 0)

diff --git a/openslp.spec b/openslp.spec
index 93a11ac..8113b4b 100644
--- a/openslp.spec
+++ b/openslp.spec
@@ -44,6 +44,9 @@ Patch9:  openslp-2.0.0-cwe-843-knownda-type-confusion.patch
 # Patch10: fixes heap buffer overflow in ProcessDASrvRqst when copying
 #   initial DAAdvert into fixed 4096-byte buffer
 Patch10:  openslp-2.0.0-processDASrvRqst-buffer-overflow.patch
+# Patch11: fixes reply size truncation from size_t to the 24-bit header
+#   length field in SrvRply, AttrRply and SrvTypeRply
+Patch11:  openslp-2.0.0-reply-size-truncation.patch
 
 BuildRequires: make
 BuildRequires: automake libtool
@@ -88,6 +91,7 @@ OpenSLP server daemon to dynamically register services.
 %patch -P8 -p1 -b .dhcp-integer-overflow
 %patch -P9 -p1 -b .cwe-843-knownda-type-confusion
 %patch -P10 -p1 -b .processDASrvRqst-buffer-overflow
+%patch -P11 -p1 -b .reply-size-truncation
 
 # tarball goof (?), it wants to re-automake anyway, so let's do it right.
 #libtoolize --force
@@ -188,6 +192,8 @@ rm -f  $RPM_BUILD_ROOT%{_libdir}/lib*.la
 * Mon Nov 09 2026 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.0.0-45
 - Fix heap buffer overflow in ProcessDASrvRqst when copying initial
   DAAdvert into fixed 4096-byte buffer
+- Fix reply size truncation from size_t to the 24-bit header length field
+  in SrvRply, AttrRply and SrvTypeRply
 
 * Wed Sep 30 2026 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.0.0-45
 - Fix type confusion in KnownDABadDA call, so that failed directory agents

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-09  9:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09  9:21 [rpms/openslp] rawhide: Fix reply size truncation in SrvRply, AttrRply and SrvTypeRply Vitezslav Crhonek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox