diff options
author | Jeremy Allison <jra@samba.org> | 2001-04-08 20:31:39 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-04-08 20:31:39 +0000 |
commit | 98560fa3944b1eb8cc01df05b93408753296b4a5 (patch) | |
tree | adf716d6a4ec314294798088bf59883fca116001 | |
parent | f9a15ce1a69f905e94db7650f0a4805720cd9c88 (diff) | |
download | samba-98560fa3944b1eb8cc01df05b93408753296b4a5.tar.gz samba-98560fa3944b1eb8cc01df05b93408753296b4a5.tar.bz2 samba-98560fa3944b1eb8cc01df05b93408753296b4a5.zip |
HEAD specific slprintf paranoia fixes.
Jeremy.
(This used to be commit 61723c18f96a7b38cab0fcf545da7fb3640c5f7b)
-rw-r--r-- | source3/passdb/nispass.c | 10 | ||||
-rw-r--r-- | source3/passdb/pdb_tdb.c | 12 |
2 files changed, 11 insertions, 11 deletions
diff --git a/source3/passdb/nispass.c b/source3/passdb/nispass.c index 2959f6ca7c..57ae8b3a99 100644 --- a/source3/passdb/nispass.c +++ b/source3/passdb/nispass.c @@ -636,10 +636,10 @@ static BOOL add_nisp21pwd_entry(struct sam_passwd *newpwd) slprintf(pwdlchg_t, 13, "CCT-%08X", (uint32)newpwd->pass_can_change_time); slprintf(pwdmchg_t, 13, "MCT-%08X", (uint32)newpwd->pass_must_change_time); - slprintf(uid, sizeof(uid), "%u", newpwd->smb_userid); - slprintf(user_rid, sizeof(user_rid), "0x%x", newpwd->user_rid); - slprintf(smb_grpid, sizeof(smb_grpid), "%u", newpwd->smb_grpid); - slprintf(group_rid, sizeof(group_rid), "0x%x", newpwd->group_rid); + slprintf(uid, sizeof(uid)-1, "%u", newpwd->smb_userid); + slprintf(user_rid, sizeof(user_rid)-1, "0x%x", newpwd->user_rid); + slprintf(smb_grpid, sizeof(smb_grpid)-1, "%u", newpwd->smb_grpid); + slprintf(group_rid, sizeof(group_rid)-1, "0x%x", newpwd->group_rid); safe_strcpy(acb, pdb_encode_acct_ctrl(newpwd->acct_ctrl, NEW_PW_FORMAT_SPACE_PADDED_LEN), sizeof(acb)-1); @@ -868,7 +868,7 @@ static BOOL mod_nisp21pwd_entry(struct sam_passwd* pwd, BOOL override) pwd->pass_last_set_time = time(NULL); if(got_pass_last_set_time) { - slprintf(lct, 12, "LCT-%08X", (uint32)pwd->pass_last_set_time); + slprintf(lct, 13, "LCT-%08X", (uint32)pwd->pass_last_set_time); } set_single_attribute(obj, NPF_LMPWD, lmpwd, strlen(lmpwd), EN_CRYPT); diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c index 740d8b1c5f..0003b024c9 100644 --- a/source3/passdb/pdb_tdb.c +++ b/source3/passdb/pdb_tdb.c @@ -404,7 +404,7 @@ SAM_ACCOUNT* pdb_getsampwnam (char *sname) pstrcat (tdbfile, PASSDB_FILE_NAME); /* set search key */ - slprintf(keystr, sizeof(keystr), "%s%s", USERPREFIX, name); + slprintf(keystr, sizeof(keystr)-1, "%s%s", USERPREFIX, name); key.dptr = keystr; key.dsize = strlen (keystr) + 1; @@ -496,7 +496,7 @@ SAM_ACCOUNT* pdb_getsampwrid (uint32 rid) pstrcat (tdbfile, RIDDB_FILE_NAME); /* set search key */ - slprintf(keystr, sizeof(keystr), "%s%.8x", RIDPREFIX, rid); + slprintf(keystr, sizeof(keystr)-1, "%s%.8x", RIDPREFIX, rid); key.dptr = keystr; key.dsize = strlen (keystr) + 1; @@ -553,7 +553,7 @@ BOOL pdb_delete_sam_account(char *sname) } /* set the search key */ - slprintf(keystr, sizeof(keystr), "%s%s", USERPREFIX, name); + slprintf(keystr, sizeof(keystr)-1, "%s%s", USERPREFIX, name); key.dptr = keystr; key.dsize = strlen (keystr) + 1; @@ -599,7 +599,7 @@ BOOL pdb_delete_sam_account(char *sname) } /* set the search key */ - slprintf(keystr, sizeof(keystr), "%s%.8x", RIDPREFIX, rid); + slprintf(keystr, sizeof(keystr)-1, "%s%.8x", RIDPREFIX, rid); key.dptr = keystr; key.dsize = strlen (keystr) + 1; @@ -655,7 +655,7 @@ static BOOL tdb_update_sam(SAM_ACCOUNT* newpwd, BOOL override, int flag) strlower (name); /* setup the USER index key */ - slprintf(keystr, sizeof(keystr), "%s%s", USERPREFIX, name); + slprintf(keystr, sizeof(keystr)-1, "%s%s", USERPREFIX, name); key.dptr = keystr; key.dsize = strlen (keystr) + 1; @@ -702,7 +702,7 @@ static BOOL tdb_update_sam(SAM_ACCOUNT* newpwd, BOOL override, int flag) pstrcat (tdbfile, RIDDB_FILE_NAME); /* setup the RID index key */ - slprintf(keystr, sizeof(keystr), "%s%.8x", RIDPREFIX, pdb_get_user_rid(newpwd)); + slprintf(keystr, sizeof(keystr)-1, "%s%.8x", RIDPREFIX, pdb_get_user_rid(newpwd)); key.dptr = keystr; key.dsize = strlen (keystr) + 1; |