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

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

krb5 commit: Initialize outpos in krb5int_utf8_normalize

daemon@ATHENA.MIT.EDU (Greg Hudson)
Tue Apr 9 12:29:04 2013

Date: Tue, 9 Apr 2013 12:28:58 -0400
From: Greg Hudson <ghudson@mit.edu>
Message-Id: <201304091628.r39GSwwA013767@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/893a178cbdc03ee9d1936c95a3f567cb2796420d
commit 893a178cbdc03ee9d1936c95a3f567cb2796420d
Author: Greg Hudson <ghudson@mit.edu>
Date:   Tue Apr 9 11:43:54 2013 -0400

    Initialize outpos in krb5int_utf8_normalize
    
    After k5memdup0 was slightly modified in
    31124ffb81e8c0935403a9fdc169dead5ecaa777, some older versions of gcc
    complain about outpos being possibly used before it is initialized.
    This can't actually happen, but we can silence the error and also
    simplify how outpos is initialized.

 src/lib/krb5/unicode/ucstr.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/src/lib/krb5/unicode/ucstr.c b/src/lib/krb5/unicode/ucstr.c
index 38d8d47..ea96335 100644
--- a/src/lib/krb5/unicode/ucstr.c
+++ b/src/lib/krb5/unicode/ucstr.c
@@ -109,7 +109,7 @@ krb5int_utf8_normalize(
 		       krb5_data ** newdataptr,
 		       unsigned flags)
 {
-    int i, j, len, clen, outpos, ucsoutlen, outsize;
+    int i, j, len, clen, outpos = 0, ucsoutlen, outsize;
     char *out = NULL, *outtmp, *s;
     krb5_ucs4 *ucs = NULL, *p, *ucsout = NULL;
     krb5_data *newdata;
@@ -144,7 +144,6 @@ krb5int_utf8_normalize(
 		retval = ENOMEM;
 		goto cleanup;
 	    }
-	    outpos = 0;
 
 	    for (i = 1; (i < len) && KRB5_UTF8_ISASCII(s + i); i++) {
 		out[outpos++] = TOLOWER(s[i - 1]);
@@ -182,7 +181,6 @@ krb5int_utf8_normalize(
 	    retval = ENOMEM;
 	    goto cleanup;
 	}
-	outpos = 0;
 	i = 0;
     }
 
_______________________________________________
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