* kdb5_ldap_realm.c (kdb5_ldap_create): In assertion test of hardcoded char
authorKen Raeburn <raeburn@mit.edu>
Tue, 15 Aug 2006 23:45:54 +0000 (23:45 +0000)
committerKen Raeburn <raeburn@mit.edu>
Tue, 15 Aug 2006 23:45:54 +0000 (23:45 +0000)
array sizes, test against the size we actually need.

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

src/plugins/kdb/ldap/ldap_util/kdb5_ldap_realm.c

index 1e597b7c518d99a10272bd913cfeb9b0974d52f4..2c62522af3907a7a1be871c22b0e7fb7f25b1aa7 100644 (file)
@@ -853,7 +853,7 @@ void kdb5_ldap_create(argc, argv)
            com_err(argv[0], retval, "gethostbyname, while adding entries to the database");
            goto err_nomsg;
        }
-       assert (sizeof(princ_name) >= MAXHOSTNAMELEN + 8);
+       assert (sizeof(princ_name) >= strlen(hp->h_name) + strlen(global_params.realm) + 9);
        /* snprintf(princ_name, MAXHOSTNAMELEN + 8, "kadmin/%s", hp->h_name); */
        snprintf(princ_name, sizeof(princ_name), "kadmin/%s@%s", hp->h_name, global_params.realm);      
        if ((retval = krb5_parse_name(util_context, princ_name, &p))) {