Changed so that the krb5_data structures (in the principal structure)
authorTheodore Tso <tytso@mit.edu>
Thu, 20 Aug 1992 01:30:33 +0000 (01:30 +0000)
committerTheodore Tso <tytso@mit.edu>
Thu, 20 Aug 1992 01:30:33 +0000 (01:30 +0000)
have nulls at the end of the strings, just in case poeple are depending
on it.  They shouldn't, since principals component may have embedded
NULL's in them, even though they usually don't.  Nevertheless, it's good
to be careful.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2334 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/ccache/file/fcc_read.c

index e59e8c82ab161e84c04b9260922d9df5916b3a95..b41ce1b9b5673d1e4c539ddd4ebb8a39d8a5156f 100644 (file)
@@ -228,7 +228,7 @@ krb5_fcc_read_data(id, data)
        return KRB5_OK;
      }
 
-     data->data = (char *) malloc(data->length);
+     data->data = (char *) malloc(data->length+1);
      if (data->data == NULL)
          return KRB5_CC_NOMEM;
 
@@ -242,11 +242,8 @@ krb5_fcc_read_data(id, data)
         xfree(data->data);
         return KRB5_CC_END;
      }
+     data->data[data->length] = 0; /* Null terminate, just in case.... */
      return KRB5_OK;
- errout:
-     if (data->data)
-        xfree(data->data);
-     return kret;
 }
 
 krb5_error_code