]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix gss_str_to_oid for OIDs with zero-valued arcs
authorLuke Howard <lukeh@padl.com>
Sun, 30 Dec 2012 15:36:25 +0000 (10:36 -0500)
committerGreg Hudson <ghudson@mit.edu>
Tue, 1 Jan 2013 22:41:49 +0000 (17:41 -0500)
gss_str_to_oid wasn't outputting any bytes for a zero-valued arc.  It
should output one byte with value 0.

[ghudson@mit.edu: commit message]

ticket: 7523 (new)
target_version: 1.11.1
tags: pullup

src/lib/gssapi/generic/oid_ops.c

index 85584fc3bdd352c7c827a54373a3a80f5c2bc440..de38dd72410cdcd955a76b993486f0d07ae6f751 100644 (file)
@@ -345,10 +345,10 @@ generic_gss_str_to_oid(OM_uint32 *minor_status,
         if (sscanf((char *)bp, "%ld", &numbuf) != 1) {
             return(GSS_S_FAILURE);
         }
-        while (numbuf) {
+        do {
             nbytes++;
             numbuf >>= 7;
-        }
+        } while (numbuf);
         while ((bp < &cp[oid_str->length]) && isdigit(*bp))
             bp++;
         while ((bp < &cp[oid_str->length]) &&
@@ -386,20 +386,20 @@ generic_gss_str_to_oid(OM_uint32 *minor_status,
                 nbytes = 0;
                 /* Have to fill in the bytes msb-first */
                 onumbuf = numbuf;
-                while (numbuf) {
+                do {
                     nbytes++;
                     numbuf >>= 7;
-                }
+                } while (numbuf);
                 numbuf = onumbuf;
                 op += nbytes;
                 i = -1;
-                while (numbuf) {
+                do {
                     op[i] = (unsigned char) numbuf & 0x7f;
                     if (i != -1)
                         op[i] |= 0x80;
                     i--;
                     numbuf >>= 7;
-                }
+                } while (numbuf);
                 while (isdigit(*bp))
                     bp++;
                 while (isspace(*bp) || *bp == '.')