diff options
author | Jeremy Allison <jra@samba.org> | 2011-05-03 13:10:01 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2011-05-04 12:12:13 -0700 |
commit | 017e0c8d95fe8212b006e1c14aef8d96fed30674 (patch) | |
tree | 3bb209bc92d298d17255a69713981a7df18d0b8b /source3 | |
parent | deba880986b1029fa059fcfba9b2a72abf598a9b (diff) | |
download | samba-017e0c8d95fe8212b006e1c14aef8d96fed30674.tar.gz samba-017e0c8d95fe8212b006e1c14aef8d96fed30674.tar.bz2 samba-017e0c8d95fe8212b006e1c14aef8d96fed30674.zip |
Fix simple uses of safe_strcpy -> strlcpy. Easy ones where we just remove -1.
Diffstat (limited to 'source3')
-rw-r--r-- | source3/nmbd/nmbd_sendannounce.c | 2 | ||||
-rw-r--r-- | source3/torture/msgtest.c | 2 | ||||
-rw-r--r-- | source3/utils/net_rap.c | 4 | ||||
-rw-r--r-- | source3/winbindd/wb_fill_pwent.c | 2 | ||||
-rw-r--r-- | source3/winbindd/winbindd_group.c | 4 | ||||
-rw-r--r-- | source3/winbindd/winbindd_pam.c | 4 |
6 files changed, 9 insertions, 9 deletions
diff --git a/source3/nmbd/nmbd_sendannounce.c b/source3/nmbd/nmbd_sendannounce.c index e04e1f6fe3..b389c02278 100644 --- a/source3/nmbd/nmbd_sendannounce.c +++ b/source3/nmbd/nmbd_sendannounce.c @@ -105,7 +105,7 @@ static void send_announcement(struct subnet_record *subrec, int announce_type, SCVAL(p,0,updatecount); SIVAL(p,1,announce_interval*1000); /* Milliseconds - despite the spec. */ - safe_strcpy(upper_server_name, server_name, sizeof(upper_server_name)-1); + strlcpy(upper_server_name, server_name ? server_name : "", sizeof(upper_server_name)); strupper_m(upper_server_name); push_string_check(p+5, upper_server_name, 16, STR_ASCII|STR_TERMINATE); diff --git a/source3/torture/msgtest.c b/source3/torture/msgtest.c index 607d4c3bb1..c7fa3153d8 100644 --- a/source3/torture/msgtest.c +++ b/source3/torture/msgtest.c @@ -85,7 +85,7 @@ static void pong_message(struct messaging_context *msg_ctx, /* Now test that the duplicate filtering code works. */ pong_count = 0; - safe_strcpy(buf, "1234567890", sizeof(buf)-1); + strlcpy(buf, "1234567890", sizeof(buf)); for (i=0;i<n;i++) { messaging_send(msg_ctx, messaging_server_id(msg_ctx), MSG_PING, diff --git a/source3/utils/net_rap.c b/source3/utils/net_rap.c index afda222740..21a4f0a170 100644 --- a/source3/utils/net_rap.c +++ b/source3/utils/net_rap.c @@ -824,7 +824,7 @@ static int rap_user_add(struct net_context *c, int argc, const char **argv) if (!NT_STATUS_IS_OK(net_make_ipc_connection(c, 0, &cli))) return -1; - safe_strcpy((char *)userinfo.user_name, argv[0], sizeof(userinfo.user_name)-1); + strlcpy((char *)userinfo.user_name, argv[0], sizeof(userinfo.user_name)); if (c->opt_flags == 0) c->opt_flags = 0x21; @@ -969,7 +969,7 @@ static int rap_group_add(struct net_context *c, int argc, const char **argv) return -1; /* BB check for length 21 or smaller explicitly ? BB */ - safe_strcpy((char *)grinfo.group_name, argv[0], sizeof(grinfo.group_name)-1); + strlcpy((char *)grinfo.group_name, argv[0], sizeof(grinfo.group_name)); grinfo.reserved1 = '\0'; grinfo.comment = smb_xstrdup(c->opt_comment ? c->opt_comment : ""); diff --git a/source3/winbindd/wb_fill_pwent.c b/source3/winbindd/wb_fill_pwent.c index 23057384c2..37d45357db 100644 --- a/source3/winbindd/wb_fill_pwent.c +++ b/source3/winbindd/wb_fill_pwent.c @@ -194,7 +194,7 @@ static bool fillup_pw_field(const char *lp_template, if (!templ) return False; - safe_strcpy(out, templ, sizeof(fstring) - 1); + strlcpy(out, templ, sizeof(fstring)); TALLOC_FREE(templ); return True; diff --git a/source3/winbindd/winbindd_group.c b/source3/winbindd/winbindd_group.c index a985fa254f..1e4ad5fa8a 100644 --- a/source3/winbindd/winbindd_group.c +++ b/source3/winbindd/winbindd_group.c @@ -60,8 +60,8 @@ bool fill_grent(TALLOC_CTX *mem_ctx, struct winbindd_gr *gr, /* Group name and password */ - safe_strcpy(gr->gr_name, full_group_name, sizeof(gr->gr_name) - 1); - safe_strcpy(gr->gr_passwd, "x", sizeof(gr->gr_passwd) - 1); + strlcpy(gr->gr_name, full_group_name, sizeof(gr->gr_name)); + strlcpy(gr->gr_passwd, "x", sizeof(gr->gr_passwd)); return True; } diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c index 412ec8370a..93c691b13b 100644 --- a/source3/winbindd/winbindd_pam.c +++ b/source3/winbindd/winbindd_pam.c @@ -1514,8 +1514,8 @@ enum winbindd_result winbindd_dual_pam_auth(struct winbindd_domain *domain, fstr_sprintf( domain_user, "%s%c%s", name_domain, *lp_winbind_separator(), name_user ); - safe_strcpy( state->request->data.auth.user, domain_user, - sizeof(state->request->data.auth.user)-1 ); + strlcpy( state->request->data.auth.user, domain_user, + sizeof(state->request->data.auth.user)); } if (!domain->online) { |