public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Vitezslav Crhonek <vcrhonek@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/sblim-sfcc] rawhide: Fix missing EOF handling in readData()
Date: Fri, 25 Sep 2026 07:57:46 GMT	[thread overview]
Message-ID: <179032306652.1.713994073039781885.rpms-sblim-sfcc-8a496997bc1c@fedoraproject.org> (raw)

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
 

                 reply	other threads:[~2026-09-25  7:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179032306652.1.713994073039781885.rpms-sblim-sfcc-8a496997bc1c@fedoraproject.org \
    --to=vcrhonek@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox