]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Initialize outpos in krb5int_utf8_normalize
authorGreg Hudson <ghudson@mit.edu>
Tue, 9 Apr 2013 15:43:54 +0000 (11:43 -0400)
committerGreg Hudson <ghudson@mit.edu>
Tue, 9 Apr 2013 15:43:54 +0000 (11:43 -0400)
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

index 38d8d47d02cf8887fb51b1033613e407a540c801..ea96335ef65eaea4b06d106ce144cb48b61ba1f2 100644 (file)
@@ -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;
     }