public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/sblim-sfcc] rawhide: Fix missing EOF handling in readData()
@ 2026-09-25  7:57 Vitezslav Crhonek
  0 siblings, 0 replies; only message in thread
From: Vitezslav Crhonek @ 2026-09-25  7:57 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/sblim-sfcc
Branch : rawhide
Commit : 8a496997bc1c7f2edb376f0541ffee4a9bcf5638
Author : Vitezslav Crhonek <vcrhonek@redhat.com>
Date   : 2026-09-25T09:53:54+02:00
Stats  : +55/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/sblim-sfcc/c/8a496997bc1c7f2edb376f0541ffee4a9bcf5638?branch=rawhide

Log:
Fix missing EOF handling in readData()

---
diff --git a/sblim-sfcc-2.2.8-fix-readdata-missing-eof.patch b/sblim-sfcc-2.2.8-fix-readdata-missing-eof.patch
new file mode 100644
index 0000000..664671b
--- /dev/null
+++ b/sblim-sfcc-2.2.8-fix-readdata-missing-eof.patch
@@ -0,0 +1,48 @@
+diff -up sblim-sfcc-2.2.8/backend/cimxml/indicationlistener.c.orig sblim-sfcc-2.2.8/backend/cimxml/indicationlistener.c
+--- sblim-sfcc-2.2.8/backend/cimxml/indicationlistener.c.orig	2026-09-16 09:48:24.971256663 +0200
++++ sblim-sfcc-2.2.8/backend/cimxml/indicationlistener.c	2026-09-16 09:48:24.972483142 +0200
+@@ -169,14 +169,23 @@ static char *getNextHdr(Buffer * b)
+     return NULL;
+ }
+ 
++/* Read up to 'length' bytes from the connection.  Returns the number of bytes
++   actually read (never negative), which may be short on EOF or on a fatal
++   read error. */
+ static int readData(CommHndl conn_fd, char *into, int length)
+ {
+     int c = 0, r;
+ 
+     while (c < length) {
+         r = commRead(conn_fd, into + c, length - c);
+-        if (r < 0 && (errno == EINTR || errno == EAGAIN)) {
+-            continue;
++        if (r == 0) {
++            break;              /* EOF - peer closed, no more data coming */
++        }
++        if (r < 0) {
++            if (errno == EINTR || errno == EAGAIN) {
++                continue;
++            }
++            break;              /* fatal read error */
+         }
+         c += r;
+     }
+@@ -186,11 +195,16 @@ static int readData(CommHndl conn_fd, ch
+ static void getPayload(CommHndl conn_fd, Buffer * b)
+ {
+     int c = b->length - b->ptr;
++    int r;
+     b->content = (char *) malloc(b->content_length + 8);
+     if (c) memcpy(b->content, (b->data) + b->ptr, c);
+ 
+-    readData(conn_fd, (b->content) + c, b->content_length - c);
+-    *((b->content) + b->content_length) = 0;
++    r = readData(conn_fd, (b->content) + c, b->content_length - c);
++    /* readData() may return short on EOF or error; terminate after what was
++       really read so the parser never sees uninitialized heap from the
++       malloc() above.  Clamped to content_length to keep the write inside
++       the allocation. */
++    *((b->content) + (c + r > b->content_length ? b->content_length : c + r)) = 0;
+ }
+ 
+ static int  getHdrs(CommHndl conn_fd, Buffer * b, char *cmd)

diff --git a/sblim-sfcc.spec b/sblim-sfcc.spec
index 6a13345..9cc3490 100644
--- a/sblim-sfcc.spec
+++ b/sblim-sfcc.spec
@@ -7,7 +7,7 @@
 Summary: Small Footprint CIM Client Library
 Name: sblim-sfcc
 Version: 2.2.8
-Release: 33%{?dist}
+Release: 34%{?dist}
 License: EPL-1.0
 URL: http://www.sblim.org
 Source0: http://downloads.sourceforge.net/project/sblim/%{name}/%{name}-%{version}.tar.bz2
@@ -21,6 +21,9 @@ Patch3: sblim-sfcc-2.2.8-fix-clone-stack-exhaust.patch
 Patch4: sblim-sfcc-2.2.8-fix-method-buffer-overflow.patch
 # Patch5: fixes buffer overflow in CIMObject namespace handling
 Patch5: sblim-sfcc-2.2.8-fix-namespace-buffer-overflow.patch
+# Patch6: fixes missing EOF and error handling in readData(), which hung the
+#   indication listener in an infinite loop
+Patch6: sblim-sfcc-2.2.8-fix-readdata-missing-eof.patch
 BuildRequires: make
 BuildRequires: curl-devel chrpath
 BuildRequires: gcc gcc-c++
@@ -71,6 +74,9 @@ chrpath --delete $RPM_BUILD_ROOT%{_libdir}/libcmpisfcc.so.1.0.0
 %{_libdir}/libcmpisfcc.so
 
 %changelog
+* Fri Sep 25 2026 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.2.8-34
+- Fix missing EOF handling in readData()
+
 * Fri Jul 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.8-33
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild
 

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

only message in thread, other threads:[~2026-09-25  7:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-25  7:57 [rpms/sblim-sfcc] rawhide: Fix missing EOF handling in readData() Vitezslav Crhonek

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