krb5 commit [krb5-1.9]: Fix gss_str_to_oid for OIDs with zero-valued arcs

Tom Yu tlyu at MIT.EDU
Tue Apr 23 17:19:25 EDT 2013


https://github.com/krb5/krb5/commit/72dcd15a5c0e0f67d9b401ed83ebedd23c872b1b
commit 72dcd15a5c0e0f67d9b401ed83ebedd23c872b1b
Author: Luke Howard <lukeh at padl.com>
Date:   Sun Dec 30 10:36:25 2012 -0500

    Fix gss_str_to_oid for OIDs with zero-valued arcs
    
    gss_str_to_oid wasn't outputting any bytes for a zero-valued arc.  It
    should output one byte with value 0.
    
    [ghudson at mit.edu: commit message]
    
    (cherry picked from commit 54fa4433df7412267375240aba40959e97ac4fe2)
    
    ticket: 7615 (new)
    version_fixed: 1.9.5
    status: resolved

 src/lib/gssapi/generic/oid_ops.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/lib/gssapi/generic/oid_ops.c b/src/lib/gssapi/generic/oid_ops.c
index d7cd5a4..4322576 100644
--- a/src/lib/gssapi/generic/oid_ops.c
+++ b/src/lib/gssapi/generic/oid_ops.c
@@ -324,10 +324,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]) &&
@@ -365,20 +365,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 == '.')


More information about the cvs-krb5 mailing list