hdb: fix parsing of mkey db string

The use of the wrong value for the length of ":mkey=" was identified
by Brian May and reported via github:

  https://github.com/heimdal/heimdal/issues/40

Change-Id: I0aed86a5bb0359b7a266369076fde5e62f23b5fe
This commit is contained in:
Jeffrey Altman
2013-10-13 19:59:48 -04:00
parent 44de8701d2
commit 50381859a0

View File

@@ -65,7 +65,7 @@ hdb_resolve(krb5_context context, const char *name, krb5_keytab id)
}
db = name;
mkey = strstr(name, ":mkey=");
if(mkey == NULL || mkey[5] == '\0') {
if(mkey == NULL || mkey[6] == '\0') {
if(*name == '\0')
d->dbname = NULL;
else {
@@ -87,7 +87,7 @@ hdb_resolve(krb5_context context, const char *name, krb5_keytab id)
memmove(d->dbname, db, mkey - db);
d->dbname[mkey - db] = '\0';
d->mkey = strdup(mkey + 5);
d->mkey = strdup(mkey + 6);
if(d->mkey == NULL) {
free(d->dbname);
free(d);