Control: tag -1 patch

On Wed, Jul 03, 2024 at 12:34:06PM +0000, Matthias Klose wrote:
> Package: src:libprelude
> Version: 5.2.0-5.5
> Severity: important
> Tags: sid trixie
> User: debian-...@lists.debian.org
> Usertags: ftbfs-gcc-14

> /bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..  
> -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations 
> -Wbad-function-cast -Wcast-qual -Wcast-align -Wnested-externs -Wunused 
> -Wformat -Wformat-security -I./include -I.. -I../src/include 
> -I./libprelude-error -I../libmissing -I../libmissing   
> -I/usr/include/p11-kit-1  -Wdate-time -D_FORTIFY_SOURCE=2  -g -O2 
> -Werror=implicit-function-declaration -ffile-prefix-map=/<<PKGBUILDDIR>>=. 
> -fstack-protector-strong -fstack-clash-protection -Wformat 
> -Werror=format-security -fcf-protection -c -o idmef-data.lo idmef-data.c
> idmef-class.c: In function ‘idmef_class_get_child_attributes’:
> idmef-class.c:164:24: error: returning ‘int’ from a function with return type 
> ‘const char **’ makes pointer from integer without a cast [-Wint-conversion]
>   164 |                 return ret;
>       |                        ^~~
> make[6]: *** [Makefile:1813: idmef-class.lo] Error 1

This looks like a copy-paste bug as returning an int as char **
doesn't make much sense. Presumably the right thing is to return
NULL, as in the attached trivial patch.

This makes the package build for me. I haven't tested the resulting
binaries in any way, but the build does seem to include a test suite.

FWIW it looks to me like the only caller in the source package,
IDMEFClass::getAttributes() in bindings/c++/idmef-class.cxx,
does the right thing if it gets NULL pointer from
idmef_class_get_child_attributes(). And codesearch.d.n does not find
other callers.

Hope this helps,
-- 
Niko Tyni   nt...@debian.org
From: Niko Tyni <nt...@debian.org>
Date: Fri, 2 Aug 2024 20:50:01 +0100
X-Dgit-Generated: 5.2.0-5.5 d5540bbe1d13013371cc058216cdd3365ce4abe7
Subject: Fix idmef_class_get_child_attributes() return value

This became a compile error with GCC 14:

  idmef-class.c:164:24: error: returning ‘int’ from a function with return type ‘const char **’ makes pointer from integer without a cast [-Wint-conversion]

Bug-Debian: https://bugs.debian.org/1075197

---

diff --git a/src/idmef-class.c b/src/idmef-class.c
index 4d93334..c7281f8 100644
--- a/src/idmef-class.c
+++ b/src/idmef-class.c
@@ -161,7 +161,7 @@ const char **idmef_class_get_child_attributes(idmef_class_id_t class, idmef_clas
 
         ret = is_child_valid(class, child);
         if ( ret < 0 )
-                return ret;
+                return NULL;
 
         return object_data[class].children_list[child].attributes;
 }

Reply via email to