Avoid magic constant (32) in allocation. Use sizeof instead

This commit is contained in:
Kurt Zeilenga 2002-12-07 18:34:25 +00:00
parent 840e7f2c5c
commit 7c4445aed4

View File

@ -1560,8 +1560,9 @@ slapd_daemon_task(
gid_t gid; gid_t gid;
if( getpeereid( s, &uid, &gid ) == 0 ) { if( getpeereid( s, &uid, &gid ) == 0 ) {
authid = ch_malloc( sizeof("uidNumber=+gidNumber=+," authid = ch_malloc(
"cn=peercred,cn=external,cn=auth") + 32); sizeof("uidNumber=XXXXXX+gidNumber=XXXXXX,"
"cn=peercred,cn=external,cn=auth"));
sprintf(authid, "uidNumber=%d+gidNumber=%d," sprintf(authid, "uidNumber=%d+gidNumber=%d,"
"cn=peercred,cn=external,cn=auth", "cn=peercred,cn=external,cn=auth",
uid, gid); uid, gid);