URL: https://github.com/SSSD/sssd/pull/5826
Author: alexey-tikhonov
 Title: #5826: DEBUG: fix missing "va_end"
Action: opened

PR body:
"""
Fixes following warning:
```
Error: VARARGS (CWE-237):
sssd-2.6.0/src/util/debug.c:294: va_init: Initializing va_list "ap_fallback".
sssd-2.6.0/src/util/debug.c:305: missing_va_end: "va_end" was not called for 
"ap_fallback".
 #  303|                                  debug_chain_id, format);
 #  304|                   if (ret < 0) {
 #  305|->                     return;
 #  306|                   }
 #  307|                   result_fmt = chain_id_fmt_dyn;
```
"""

To pull the PR as Git branch:
git remote add ghsssd https://github.com/SSSD/sssd
git fetch ghsssd pull/5826/head:pr5826
git checkout pr5826
From 6b03052eeedbdf7250016f1e29553393342acc22 Mon Sep 17 00:00:00 2001
From: Alexey Tikhonov <atikh...@redhat.com>
Date: Thu, 14 Oct 2021 18:48:09 +0200
Subject: [PATCH] DEBUG: fix missing "va_end"

Fixes following warning:
```
Error: VARARGS (CWE-237):
sssd-2.6.0/src/util/debug.c:294: va_init: Initializing va_list "ap_fallback".
sssd-2.6.0/src/util/debug.c:305: missing_va_end: "va_end" was not called for "ap_fallback".
 #  303|                                  debug_chain_id, format);
 #  304|                   if (ret < 0) {
 #  305|->                     return;
 #  306|                   }
 #  307|                   result_fmt = chain_id_fmt_dyn;
```
---
 src/util/debug.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/util/debug.c b/src/util/debug.c
index 51fb42d3cf..7c03fb7dff 100644
--- a/src/util/debug.c
+++ b/src/util/debug.c
@@ -297,11 +297,13 @@ void sss_vdebug_fn(const char *file,
             ret = snprintf(chain_id_fmt_fixed, sizeof(chain_id_fmt_fixed),
                            DEBUG_CHAIN_ID_FMT"%s", debug_chain_id, format);
             if (ret < 0) {
+                va_end(ap_fallback);
                 return;
             } else if (ret >= sizeof(chain_id_fmt_fixed)) {
                 ret = asprintf(&chain_id_fmt_dyn, DEBUG_CHAIN_ID_FMT"%s",
                                debug_chain_id, format);
                 if (ret < 0) {
+                    va_end(ap_fallback);
                     return;
                 }
                 result_fmt = chain_id_fmt_dyn;
_______________________________________________
sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org
To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/sssd-devel@lists.fedorahosted.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to