smbd: Fix CID 1035365 Buffer not null terminated
authorVolker Lendecke <vl@samba.org>
Sun, 10 Nov 2013 10:58:58 +0000 (11:58 +0100)
committerIra Cooper <ira@samba.org>
Mon, 11 Nov 2013 20:04:09 +0000 (21:04 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
source3/lib/conn_tdb.c

index 2169756c79170123880017194eae7b8183f2bdb3..bf66d7d7b66c5251e6715eb3e4aa3c95bf01b94e 100644 (file)
@@ -60,8 +60,8 @@ static int collect_sessions_fn(struct smbXsrv_session_global0 *global,
                sess.uid = global->auth_session_info->unix_token->uid;
                sess.gid = global->auth_session_info->unix_token->gid;
        }
-       strncpy(sess.machine, global->channels[0].remote_name, sizeof(sess.machine));
-       strncpy(sess.addr, global->channels[0].remote_address, sizeof(sess.addr));
+       fstrcpy(sess.machine, global->channels[0].remote_name);
+       fstrcpy(sess.addr, global->channels[0].remote_address);
 
        status = dbwrap_store(state->session_by_pid,
                              make_tdb_data((void*)&id, sizeof(id)),