]> 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)
committerTom Yu <tlyu@mit.edu>
Fri, 22 Feb 2013 23:23:59 +0000 (18:23 -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]

(cherry picked from commit 54fa4433df7412267375240aba40959e97ac4fe2)

ticket: 7579 (new)
version_fixed: 1.10.4
status: resolved

src/lib/gssapi/generic/oid_ops.c

index 535fe57d8f0ff5943c871358432961cbf98aa908..7645efe9ffaf426186e87aaa19b1c79054c6c9cb 100644 (file)
@@ -339,10 +339,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]) &&
@@ -380,20 +380,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 == '.')