[30530] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Remove strerror() calls from k5_get_error()

daemon@ATHENA.MIT.EDU (Greg Hudson)
Mon Jun 10 11:32:34 2019

Date: Mon, 10 Jun 2019 11:32:28 -0400
From: Greg Hudson <ghudson@mit.edu>
Message-ID: <201906101532.x5AFWStA014781@drugstore.mit.edu>
To: <cvs-krb5@mit.edu>
MIME-Version: 1.0
Reply-To: krbdev@mit.edu
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/2d400bea7a81a5a834a1be6ded439f18e0afa5ba
commit 2d400bea7a81a5a834a1be6ded439f18e0afa5ba
Author: Greg Hudson <ghudson@mit.edu>
Date:   Thu Jun 6 11:46:58 2019 -0400

    Remove strerror() calls from k5_get_error()
    
    Coverity models strerror() as a function which cannot accept negative
    values, even though it has defined behavior on all integers.
    k5_get_error() contains code to call strerror_r() and strerror() if
    its fptr global is unset, which isn't an expected case in practice.
    To silence a large number of Coverity false positives, just return a
    fixed string if fptr is null.

 src/util/support/errors.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/util/support/errors.c b/src/util/support/errors.c
index 70e1d59..f8bea07 100644
--- a/src/util/support/errors.c
+++ b/src/util/support/errors.c
@@ -78,10 +78,9 @@ k5_get_error(struct errinfo *ep, long code)
 
     lock();
     if (fptr == NULL) {
+        /* Should be rare; fptr should be set whenever libkrb5 is loaded. */
         unlock();
-        if (strerror_r(code, buf, sizeof(buf)) == 0)
-            return oom_check(strdup(buf));
-        return oom_check(strdup(strerror(code)));
+        return oom_check(strdup(_("Error code translation unavailable")));
     }
     r = fptr(code);
 #ifndef HAVE_COM_ERR_INTL
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post