From d431a41a7a0f44ff2d0e5c69fb8a6901f72d0b55 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Mon, 2 Feb 2009 23:41:40 +0000 Subject: [PATCH] Remove unnecessary pointer casts in args to free,memcpy,memset,memchr except unicode, windows code git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21875 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/bsd/krcp.c | 2 +- src/appl/bsd/krlogind.c | 4 +- src/appl/bsd/krshd.c | 4 +- src/appl/gss-sample/gss-client.c | 2 +- src/appl/gssftp/ftp/ftp.c | 2 +- src/appl/gssftp/ftpd/ftpd.c | 2 +- src/appl/gssftp/ftpd/popen.c | 2 +- src/appl/simple/client/sim_client.c | 10 ++--- src/appl/simple/server/sim_server.c | 4 +- src/appl/telnet/libtelnet/auth.c | 5 +-- src/appl/telnet/libtelnet/enc_des.c | 18 ++++---- src/appl/telnet/libtelnet/kerberos5.c | 2 +- src/appl/telnet/telnet/commands.c | 9 ++-- src/appl/telnet/telnet/general.h | 4 +- src/appl/telnet/telnet/ring.c | 2 +- src/appl/telnet/telnetd/sys_term.c | 6 +-- src/appl/telnet/telnetd/telnetd-ktd.c | 2 +- src/appl/telnet/telnetd/telnetd.c | 2 +- src/appl/telnet/telnetd/termstat.c | 2 +- src/appl/user_user/client.c | 4 +- src/appl/user_user/server.c | 2 +- src/clients/ksu/ccache.c | 6 +-- src/clients/ksu/heuristic.c | 4 +- src/clients/ksu/krb_auth_su.c | 12 +++--- src/kadmin/cli/kadmin.c | 2 +- src/kadmin/cli/keytab.c | 4 +- src/kadmin/dbutil/dump.c | 4 +- src/kadmin/dbutil/kdb5_create.c | 6 +-- src/kadmin/dbutil/kdb5_mkey.c | 4 +- src/kadmin/dbutil/kdb5_util.c | 4 +- src/kadmin/ktutil/ktutil_funcs.c | 4 +- src/kadmin/server/ipropd_svc.c | 2 +- src/kadmin/server/kadm_rpc_svc.c | 2 +- src/kadmin/server/ovsec_kadmd.c | 2 +- src/kdc/kdc_util.c | 4 +- src/kdc/main.c | 6 +-- src/lib/crypto/des/afsstring2key.c | 2 +- src/lib/gssapi/generic/gssapiP_generic.h | 2 +- src/lib/gssapi/krb5/init_sec_context.c | 2 +- src/lib/gssapi/krb5/util_crypt.c | 16 +++---- src/lib/gssapi/spnego/spnego_mech.c | 2 +- src/lib/kadm5/alt_prof.c | 6 +-- src/lib/kadm5/clnt/client_init.c | 5 +-- src/lib/kadm5/clnt/client_rpc.c | 42 +++++++++---------- src/lib/kadm5/kadm_rpc_xdr.c | 4 +- src/lib/kadm5/srv/server_acl.c | 2 +- src/lib/kadm5/srv/server_init.c | 2 +- src/lib/kadm5/srv/svr_principal.c | 8 ++-- src/lib/kadm5/unit-test/setkey-test.c | 6 +-- src/lib/kdb/kdb_cpw.c | 4 +- src/lib/kdb/kdb_default.c | 2 +- src/lib/krb5/asn.1/asn1glue.h | 1 - src/lib/krb5/ccache/cc_file.c | 2 +- src/lib/krb5/krb/auth_con.c | 2 +- src/lib/krb5/krb/copy_addrs.c | 2 +- src/lib/krb5/krb/copy_auth.c | 2 +- src/lib/krb5/krb/copy_cksum.c | 6 +-- src/lib/krb5/krb/copy_data.c | 2 +- src/lib/krb5/krb/copy_key.c | 3 +- src/lib/krb5/krb/copy_tick.c | 2 +- src/lib/krb5/krb/cp_key_cnt.c | 2 +- src/lib/krb5/krb/fwd_tgt.c | 4 +- src/lib/krb5/krb/get_creds.c | 6 +-- src/lib/krb5/krb/get_in_tkt.c | 2 +- src/lib/krb5/krb/kfree.c | 2 +- src/lib/krb5/krb/mk_priv.c | 2 +- src/lib/krb5/krb/mk_req.c | 2 +- src/lib/krb5/krb/mk_safe.c | 4 +- src/lib/krb5/krb/rd_safe.c | 2 +- src/lib/krb5/krb/recvauth.c | 2 +- src/lib/krb5/krb/send_tgs.c | 2 +- src/lib/krb5/krb/sendauth.c | 2 +- src/lib/krb5/krb/t_ser.c | 2 +- src/lib/krb5/os/full_ipadr.c | 12 +++--- src/lib/krb5/os/gen_port.c | 2 +- src/lib/krb5/os/mk_faddr.c | 4 +- src/lib/krb5/os/port2ip.c | 12 +++--- src/lib/rpc/auth_gssapi.c | 8 ++-- src/lib/rpc/get_myaddress.c | 2 +- src/lib/rpc/svc_auth_gssapi.c | 6 +-- src/lib/rpc/svc_tcp.c | 2 +- src/lib/rpc/svc_udp.c | 6 +-- src/lib/rpc/unit-test/rpc_test_clnt.c | 2 +- src/lib/rpc/unit-test/rpc_test_svc.c | 2 +- src/plugins/kdb/db2/kdb_db2.c | 8 ++-- src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c | 4 +- .../kdb/ldap/libkdb_ldap/ldap_krbcontainer.c | 2 +- src/plugins/kdb/ldap/libkdb_ldap/ldap_realm.c | 4 +- .../kdb/ldap/libkdb_ldap/ldap_service_stash.c | 2 +- src/slave/kprop.c | 12 +++--- src/slave/kpropd.c | 14 +++---- src/slave/kpropd_rpc.c | 6 +-- src/slave/kproplog.c | 4 +- src/tests/create/kdb5_mkdums.c | 4 +- src/tests/gss-threads/gss-client.c | 2 +- src/tests/hammer/kdc5_hammer.c | 4 +- src/tests/misc/test_getsockname.c | 8 ++-- src/tests/verify/kdb5_verify.c | 2 +- 98 files changed, 221 insertions(+), 230 deletions(-) diff --git a/src/appl/bsd/krcp.c b/src/appl/bsd/krcp.c index 07a747b10..a5370a297 100644 --- a/src/appl/bsd/krcp.c +++ b/src/appl/bsd/krcp.c @@ -1300,7 +1300,7 @@ void exit(1); } - memset ((char*)&creds, 0, sizeof(creds)); + memset (&creds, 0, sizeof(creds)); if ((status = krb5_read_message(bsd_context, (krb5_pointer)&rem, &pname_data))) diff --git a/src/appl/bsd/krlogind.c b/src/appl/bsd/krlogind.c index 01b4ef205..705285640 100644 --- a/src/appl/bsd/krlogind.c +++ b/src/appl/bsd/krlogind.c @@ -469,7 +469,7 @@ int main(argc, argv) fprintf(stderr, "Error in socket: %s\n", strerror(errno)); exit(2); } - memset((char *) &sock_in, 0,sizeof(sock_in)); + memset(&sock_in, 0,sizeof(sock_in)); sock_in.sin_family = AF_INET; sock_in.sin_port = htons(debug_port); sock_in.sin_addr.s_addr = INADDR_ANY; @@ -920,7 +920,7 @@ static int control(pty, cp, n) return (0); #ifdef TIOCSWINSZ oobdata[0] &= ~TIOCPKT_WINDOW; /* we know he heard */ - memcpy((char *)&w,cp+4, sizeof(w)); + memcpy(&w, cp+4, sizeof(w)); w.ws_row = ntohs(w.ws_row); w.ws_col = ntohs(w.ws_col); w.ws_xpixel = ntohs(w.ws_xpixel); diff --git a/src/appl/bsd/krshd.c b/src/appl/bsd/krshd.c index aa3f2edb9..76c0ca1fc 100644 --- a/src/appl/bsd/krshd.c +++ b/src/appl/bsd/krshd.c @@ -1950,7 +1950,7 @@ accept_a_connection (int debug_port, struct sockaddr *from, exit(2); } - memset((char *) &sock_in6, 0,sizeof(sock_in6)); + memset(&sock_in6, 0,sizeof(sock_in6)); sock_in6.sin6_family = AF_INET6; sock_in6.sin6_port = htons(debug_port); sock_in6.sin6_addr = in6addr_any; @@ -1982,7 +1982,7 @@ accept_a_connection (int debug_port, struct sockaddr *from, exit(2); } - memset((char *) &sock_in, 0,sizeof(sock_in)); + memset(&sock_in, 0,sizeof(sock_in)); sock_in.sin_family = AF_INET; sock_in.sin_port = htons(debug_port); sock_in.sin_addr.s_addr = INADDR_ANY; diff --git a/src/appl/gss-sample/gss-client.c b/src/appl/gss-sample/gss-client.c index 390d6e56f..f84d3c66b 100644 --- a/src/appl/gss-sample/gss-client.c +++ b/src/appl/gss-sample/gss-client.c @@ -114,7 +114,7 @@ connect_to_server(host, port) } saddr.sin_family = hp->h_addrtype; - memcpy((char *) &saddr.sin_addr, hp->h_addr, sizeof(saddr.sin_addr)); + memcpy(&saddr.sin_addr, hp->h_addr, sizeof(saddr.sin_addr)); saddr.sin_port = htons(port); if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) { diff --git a/src/appl/gssftp/ftp/ftp.c b/src/appl/gssftp/ftp/ftp.c index 3df233fcd..79d844b4d 100644 --- a/src/appl/gssftp/ftp/ftp.c +++ b/src/appl/gssftp/ftp/ftp.c @@ -196,7 +196,7 @@ hookup(char* host, int port) #endif static char hostnamebuf[80]; - memset((char *)&hisctladdr, 0, sizeof (hisctladdr)); + memset(&hisctladdr, 0, sizeof (hisctladdr)); hisctladdr.sin_addr.s_addr = inet_addr(host); if (hisctladdr.sin_addr.s_addr != -1) { hisctladdr.sin_family = AF_INET; diff --git a/src/appl/gssftp/ftpd/ftpd.c b/src/appl/gssftp/ftpd/ftpd.c index 71e985529..51072ee60 100644 --- a/src/appl/gssftp/ftpd/ftpd.c +++ b/src/appl/gssftp/ftpd/ftpd.c @@ -869,7 +869,7 @@ char *name, *passwd; char ccname[MAXPATHLEN]; #ifdef GSSAPI - memset((char *)&my_creds, 0, sizeof(my_creds)); + memset(&my_creds, 0, sizeof(my_creds)); if (krb5_parse_name(kcontext, name, &me)) return 0; my_creds.client = me; diff --git a/src/appl/gssftp/ftpd/popen.c b/src/appl/gssftp/ftpd/popen.c index 4f4f1586c..f7995f771 100644 --- a/src/appl/gssftp/ftpd/popen.c +++ b/src/appl/gssftp/ftpd/popen.c @@ -78,7 +78,7 @@ ftpd_popen(program, type) return(NULL); if ((pids = (int *)malloc((u_int)(fds * sizeof(int)))) == NULL) return(NULL); - memset((char *)pids, 0, fds * sizeof(int)); + memset(pids, 0, fds * sizeof(int)); } if (pipe(pdes) < 0) return(NULL); diff --git a/src/appl/simple/client/sim_client.c b/src/appl/simple/client/sim_client.c index 4873f89af..3cb71df52 100644 --- a/src/appl/simple/client/sim_client.c +++ b/src/appl/simple/client/sim_client.c @@ -161,9 +161,9 @@ main(argc, argv) *cp = tolower((int) *cp); /* Set server's address */ - (void) memset((char *)&s_sock, 0, sizeof(s_sock)); + (void) memset(&s_sock, 0, sizeof(s_sock)); - memcpy((char *)&s_sock.sin_addr, host->h_addr, sizeof(s_sock.sin_addr)); + memcpy(&s_sock.sin_addr, host->h_addr, sizeof(s_sock.sin_addr)); #ifdef DEBUG printf("s_sock.sin_addr is %s\n", inet_ntoa(s_sock.sin_addr)); #endif @@ -186,7 +186,7 @@ main(argc, argv) exit(1); } - memset((char *)&c_sock, 0, sizeof(c_sock)); + memset(&c_sock, 0, sizeof(c_sock)); c_sock.sin_family = AF_INET; #ifdef BROKEN_STREAMS_SOCKETS if (gethostname(my_hostname, sizeof(my_hostname)) < 0) { @@ -198,7 +198,7 @@ main(argc, argv) fprintf(stderr, "%s: unknown host\n", hostname); exit(1); } - memcpy((char *)&c_sock.sin_addr, host->h_addr, sizeof(c_sock.sin_addr)); + memcpy(&c_sock.sin_addr, host->h_addr, sizeof(c_sock.sin_addr)); #endif @@ -243,7 +243,7 @@ main(argc, argv) /* PREPARE KRB_SAFE MESSAGE */ /* Get my address */ - memset((char *) &c_sock, 0, sizeof(c_sock)); + memset(&c_sock, 0, sizeof(c_sock)); len = sizeof(c_sock); if (getsockname(sock, (struct sockaddr *)&c_sock, &len) < 0) { com_err(progname, errno, "while getting socket name"); diff --git a/src/appl/simple/server/sim_server.c b/src/appl/simple/server/sim_server.c index 137cc49f0..bfe2f756b 100644 --- a/src/appl/simple/server/sim_server.c +++ b/src/appl/simple/server/sim_server.c @@ -132,7 +132,7 @@ char *argv[]; } /* Set up server address */ - memset((char *)&s_sock, 0, sizeof(s_sock)); + memset(&s_sock, 0, sizeof(s_sock)); s_sock.sin_family = AF_INET; if (port == 0) { @@ -155,7 +155,7 @@ char *argv[]; fprintf(stderr, "%s: host unknown\n", full_hname); exit(1); } - memcpy((char *)&s_sock.sin_addr, host->h_addr, sizeof(s_sock.sin_addr)); + memcpy(&s_sock.sin_addr, host->h_addr, sizeof(s_sock.sin_addr)); /* Open socket */ if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { diff --git a/src/appl/telnet/libtelnet/auth.c b/src/appl/telnet/libtelnet/auth.c index 1a1006605..aed688799 100644 --- a/src/appl/telnet/libtelnet/auth.c +++ b/src/appl/telnet/libtelnet/auth.c @@ -383,8 +383,7 @@ auth_send(data, cnt) auth_send_cnt = cnt; if (auth_send_cnt > sizeof(_auth_send_data)) auth_send_cnt = sizeof(_auth_send_data); - memcpy((void *)_auth_send_data, (void *)data, - (unsigned) auth_send_cnt); + memcpy(_auth_send_data, data, (unsigned) auth_send_cnt); auth_send_data = _auth_send_data; auth_send_retry(); @@ -510,7 +509,7 @@ auth_name(data, cnt) Name, cnt, (int) sizeof(savename)-1); return; } - memcpy((void *)savename, (void *)data, (unsigned) cnt); + memcpy(savename, data, (unsigned) cnt); savename[cnt] = '\0'; /* Null terminate */ if (auth_debug_mode) printf(">>>%s: Got NAME [%s]\r\n", Name, savename); diff --git a/src/appl/telnet/libtelnet/enc_des.c b/src/appl/telnet/libtelnet/enc_des.c index aa00ae27e..6dd48b696 100644 --- a/src/appl/telnet/libtelnet/enc_des.c +++ b/src/appl/telnet/libtelnet/enc_des.c @@ -199,7 +199,7 @@ ofb64_init(server) fb64_init(fbp) register struct fb *fbp; { - memset((void *)fbp, 0, sizeof(*fbp)); + memset(fbp, 0, sizeof(*fbp)); fbp->state[0] = fbp->state[1] = FAILED; fbp->fb_feed[0] = IAC; fbp->fb_feed[1] = SB; @@ -600,8 +600,8 @@ fb64_stream_iv(seed, stp) Block seed; register struct stinfo *stp; { - memcpy((void *)stp->str_iv, (void *)seed, sizeof(Block)); - memcpy((void *)stp->str_output, (void *)seed, sizeof(Block)); + memcpy(stp->str_iv, seed, sizeof(Block)); + memcpy(stp->str_output, seed, sizeof(Block)); stp->str_index = sizeof(Block); } @@ -611,7 +611,7 @@ fb64_stream_key(key, stp) Block key; register struct stinfo *stp; { - memcpy((void *)stp->str_keybytes, (void *)key, sizeof(Block)); + memcpy(stp->str_keybytes, key, sizeof(Block)); stp->str_key.length = 8; stp->str_key.contents = stp->str_keybytes; /* the original version of this code uses des ecb mode, but @@ -619,7 +619,7 @@ fb64_stream_key(key, stp) is identical */ stp->str_key.enctype = ENCTYPE_DES_CBC_RAW; - memcpy((void *)stp->str_output, (void *)stp->str_iv, sizeof(Block)); + memcpy(stp->str_output, stp->str_iv, sizeof(Block)); stp->str_index = sizeof(Block); } @@ -659,7 +659,7 @@ cfb64_encrypt(s, c) if (idx == sizeof(Block)) { Block b; ecb_encrypt(stp, stp->str_output, b); - memcpy((void *)stp->str_feed,(void *)b,sizeof(Block)); + memcpy(stp->str_feed,b,sizeof(Block)); idx = 0; } @@ -693,7 +693,7 @@ cfb64_decrypt(data) if (idx == sizeof(Block)) { Block b; ecb_encrypt(stp, stp->str_output, b); - memcpy((void *)stp->str_feed, (void *)b, sizeof(Block)); + memcpy(stp->str_feed, b, sizeof(Block)); stp->str_index = 1; /* Next time will be 1 */ idx = 0; /* But now use 0 */ } @@ -735,7 +735,7 @@ ofb64_encrypt(s, c) if (idx == sizeof(Block)) { Block b; ecb_encrypt(stp, stp->str_feed, b); - memcpy((void *)stp->str_feed,(void *)b,sizeof(Block)); + memcpy(stp->str_feed,b,sizeof(Block)); idx = 0; } *s++ ^= stp->str_feed[idx]; @@ -766,7 +766,7 @@ ofb64_decrypt(data) if (idx == sizeof(Block)) { Block b; ecb_encrypt(stp, stp->str_feed, b); - memcpy((void *)stp->str_feed, (void *)b, sizeof(Block)); + memcpy(stp->str_feed, b, sizeof(Block)); stp->str_index = 1; /* Next time will be 1 */ idx = 0; /* But now use 0 */ } diff --git a/src/appl/telnet/libtelnet/kerberos5.c b/src/appl/telnet/libtelnet/kerberos5.c index 40eb184ac..77a1b5a6d 100644 --- a/src/appl/telnet/libtelnet/kerberos5.c +++ b/src/appl/telnet/libtelnet/kerberos5.c @@ -249,7 +249,7 @@ kerberos5_send(ap) return(0); } - memset((char *)&creds, 0, sizeof(creds)); + memset(&creds, 0, sizeof(creds)); if (auth_debug_mode) printf("telnet: calling krb5_sname_to_principal\n"); if ((r = krb5_sname_to_principal(telnet_context, RemoteHostName, diff --git a/src/appl/telnet/telnet/commands.c b/src/appl/telnet/telnet/commands.c index f82f3e680..a029e6381 100644 --- a/src/appl/telnet/telnet/commands.c +++ b/src/appl/telnet/telnet/commands.c @@ -3144,17 +3144,16 @@ sourceroute(arg, cpp, lenp) sin_addr.s_addr = tmp; } else if ((host = gethostbyname(cp))) { #if defined(h_addr) - memcpy((caddr_t)&sin_addr, - host->h_addr_list[0], sizeof(sin_addr)); + memcpy(&sin_addr, + host->h_addr_list[0], sizeof(sin_addr)); #else - memcpy((caddr_t)&sin_addr, host->h_addr, - sizeof(sin_addr)); + memcpy(&sin_addr, host->h_addr, sizeof(sin_addr)); #endif } else { *cpp = cp; return(0); } - memcpy(lsrp, (char *)&sin_addr, 4); + memcpy(lsrp, &sin_addr, 4); lsrp += 4; if (cp2) cp = cp2; diff --git a/src/appl/telnet/telnet/general.h b/src/appl/telnet/telnet/general.h index 4efa95194..88c29c647 100644 --- a/src/appl/telnet/telnet/general.h +++ b/src/appl/telnet/telnet/general.h @@ -41,5 +41,5 @@ #define numberof(x) (sizeof x/sizeof x[0]) #define highestof(x) (numberof(x)-1) -#define ClearElement(x) memset((char *)&x, 0, sizeof x) -#define ClearArray(x) memset((char *)x, 0, sizeof x) +#define ClearElement(x) memset(&x, 0, sizeof x) +#define ClearArray(x) memset(x, 0, sizeof x) diff --git a/src/appl/telnet/telnet/ring.c b/src/appl/telnet/telnet/ring.c index fdff682b5..6ed596f76 100644 --- a/src/appl/telnet/telnet/ring.c +++ b/src/appl/telnet/telnet/ring.c @@ -109,7 +109,7 @@ Ring *ring; unsigned char *buffer; int count; { - memset((char *)ring, 0, sizeof *ring); + memset(ring, 0, sizeof *ring); ring->size = count; diff --git a/src/appl/telnet/telnetd/sys_term.c b/src/appl/telnet/telnetd/sys_term.c index 5c08c7606..a0a0ee503 100644 --- a/src/appl/telnet/telnetd/sys_term.c +++ b/src/appl/telnet/telnetd/sys_term.c @@ -235,7 +235,7 @@ copy_termbuf(cp, len) { if (len > sizeof(termbuf)) len = sizeof(termbuf); - memcpy((char *)&termbuf, cp, len); + memcpy(&termbuf, cp, len); termbuf2 = termbuf; } #endif /* defined(LINEMODE) && defined(TIOCPKT_IOCTL) */ @@ -956,7 +956,7 @@ getptyslave() init_termbuf(); # ifdef TIOCGWINSZ if (def_row || def_col) { - memset((char *)&ws, 0, sizeof(ws)); + memset(&ws, 0, sizeof(ws)); ws.ws_col = def_col; ws.ws_row = def_row; (void)ioctl(t, TIOCSWINSZ, (char *)&ws); @@ -1137,7 +1137,7 @@ startslave(host, autologin, autoname) INIT_FIFO); fatalperror(net, tbuf); } - memset((char *)&request, 0, sizeof(request)); + memset(&request, 0, sizeof(request)); request.magic = INIT_MAGIC; SCPYN(request.gen_id, gen_id); SCPYN(request.tty_id, &line[8]); diff --git a/src/appl/telnet/telnetd/telnetd-ktd.c b/src/appl/telnet/telnetd/telnetd-ktd.c index 295f19580..5a340bd7f 100644 --- a/src/appl/telnet/telnetd/telnetd-ktd.c +++ b/src/appl/telnet/telnetd/telnetd-ktd.c @@ -395,7 +395,7 @@ main(argc, argv) if (secflag) { int sz = sizeof(ss); - memset((char *)&dv, 0, sizeof(dv)); + memset(&dv, 0, sizeof(dv)); if (getsysv(&sysv, sizeof(struct sysv)) != 0) { perror("getsysv"); diff --git a/src/appl/telnet/telnetd/telnetd.c b/src/appl/telnet/telnetd/telnetd.c index 4115b6671..8ee129ec3 100644 --- a/src/appl/telnet/telnetd/telnetd.c +++ b/src/appl/telnet/telnetd/telnetd.c @@ -564,7 +564,7 @@ main(argc, argv) int szi = sizeof(int); #endif /* SO_SEC_MULTI */ - memset((char *)&dv, 0, sizeof(dv)); + memset(&dv, 0, sizeof(dv)); if (getsysv(&sysv, sizeof(struct sysv)) != 0) { perror("getsysv"); diff --git a/src/appl/telnet/telnetd/termstat.c b/src/appl/telnet/telnetd/termstat.c index 531e16783..fa7803dfe 100644 --- a/src/appl/telnet/telnetd/termstat.c +++ b/src/appl/telnet/telnetd/termstat.c @@ -624,7 +624,7 @@ defer_terminit() if (def_col || def_row) { struct winsize ws; - memset((char *)&ws, 0, sizeof(ws)); + memset(&ws, 0, sizeof(ws)); ws.ws_col = def_col; ws.ws_row = def_row; (void) ioctl(pty, TIOCSWINSZ, (char *)&ws); diff --git a/src/appl/user_user/client.c b/src/appl/user_user/client.c index 1ee160659..6edf0ffff 100644 --- a/src/appl/user_user/client.c +++ b/src/appl/user_user/client.c @@ -120,7 +120,7 @@ char *argv[]; return 5; } - memcpy ((char *)&serv_net_addr.sin_addr, host->h_addr_list[i++], + memcpy (&serv_net_addr.sin_addr, host->h_addr_list[i++], sizeof(serv_net_addr.sin_addr)); if (connect(s, (struct sockaddr *)&serv_net_addr, @@ -139,7 +139,7 @@ char *argv[]; return 6; } - memset ((char*)&creds, 0, sizeof(creds)); + memset (&creds, 0, sizeof(creds)); retval = krb5_cc_get_principal(context, cc, &creds.client); if (retval) { diff --git a/src/appl/user_user/server.c b/src/appl/user_user/server.c index 9d1ab19ae..40243fed0 100644 --- a/src/appl/user_user/server.c +++ b/src/appl/user_user/server.c @@ -125,7 +125,7 @@ char *argv[]; return 4; } - memset ((char*)&creds, 0, sizeof(creds)); + memset (&creds, 0, sizeof(creds)); retval = krb5_cc_get_principal(context, cc, &creds.client); if (retval) { com_err("uu-client", retval, "getting principal name"); diff --git a/src/clients/ksu/ccache.c b/src/clients/ksu/ccache.c index 8fd11a3c8..8ed5fb185 100644 --- a/src/clients/ksu/ccache.c +++ b/src/clients/ksu/ccache.c @@ -230,9 +230,9 @@ int chunk_count = 1; } - memset((char *) &temp_tktq, 0, sizeof(temp_tktq)); - memset((char *) &temp_tkt, 0, sizeof(temp_tkt)); - memset((char *) &creds, 0, sizeof(creds)); + memset(&temp_tktq, 0, sizeof(temp_tktq)); + memset(&temp_tkt, 0, sizeof(temp_tkt)); + memset(&creds, 0, sizeof(creds)); /* initialize the cursor */ if ((retval = krb5_cc_start_seq_get(context, cc, &cur))) { diff --git a/src/clients/ksu/heuristic.c b/src/clients/ksu/heuristic.c index 80482bebb..65d44a39b 100644 --- a/src/clients/ksu/heuristic.c +++ b/src/clients/ksu/heuristic.c @@ -449,8 +449,8 @@ krb5_error_code find_ticket (context, cc, client, server, found) *found = FALSE; - memset((char *) &tgtq, 0, sizeof(tgtq)); - memset((char *) &tgt, 0, sizeof(tgt)); + memset(&tgtq, 0, sizeof(tgtq)); + memset(&tgt, 0, sizeof(tgt)); retval= krb5_copy_principal(context, client, &tgtq.client); if (retval) diff --git a/src/clients/ksu/krb_auth_su.c b/src/clients/ksu/krb_auth_su.c index cd2bc89cb..f0517b8aa 100644 --- a/src/clients/ksu/krb_auth_su.c +++ b/src/clients/ksu/krb_auth_su.c @@ -59,9 +59,9 @@ krb5_boolean krb5_auth_check(context, client_pname, hostname, options, krb5_boolean zero_password; *path_passwd = 0; - memset((char *) &tgtq, 0, sizeof(tgtq)); - memset((char *) &tgt, 0, sizeof(tgt)); - memset((char *) &in_creds, 0, sizeof(krb5_creds)); + memset(&tgtq, 0, sizeof(tgtq)); + memset(&tgt, 0, sizeof(tgt)); + memset(&in_creds, 0, sizeof(krb5_creds)); if ((retval= krb5_copy_principal(context, client_pname, &client))){ @@ -241,8 +241,8 @@ krb5_boolean krb5_fast_auth(context, client, server, target_user, cc) krb5_verify_init_creds_opt vfy_opts; krb5_error_code retval; - memset((char *) &tgtq, 0, sizeof(tgtq)); - memset((char *) &tgt, 0, sizeof(tgt)); + memset(&tgtq, 0, sizeof(tgtq)); + memset(&tgt, 0, sizeof(tgt)); if ((retval= krb5_copy_principal(context, client, &tgtq.client))){ com_err(prog_name, retval,"while copying client principal"); @@ -300,7 +300,7 @@ krb5_boolean krb5_get_tkt_via_passwd (context, ccache, client, server, return (FALSE); } - memset((char *)&my_creds, 0, sizeof(my_creds)); + memset(&my_creds, 0, sizeof(my_creds)); if ((code = krb5_copy_principal(context, client, &my_creds.client))){ com_err (prog_name, code, "while copying principal"); diff --git a/src/kadmin/cli/kadmin.c b/src/kadmin/cli/kadmin.c index af6673d07..557b63a25 100644 --- a/src/kadmin/cli/kadmin.c +++ b/src/kadmin/cli/kadmin.c @@ -216,7 +216,7 @@ char *kadmin_startup(argc, argv) char *db_name = NULL; char *svcname; - memset((char *) ¶ms, 0, sizeof(params)); + memset(¶ms, 0, sizeof(params)); #if defined(USE_KIM) /* Turn off all password prompting from the KLL */ diff --git a/src/kadmin/cli/keytab.c b/src/kadmin/cli/keytab.c index 89fbe66b1..5fb5613f2 100644 --- a/src/kadmin/cli/keytab.c +++ b/src/kadmin/cli/keytab.c @@ -266,7 +266,7 @@ int add_principal(void *lhandle, char *keytab_str, krb5_keytab keytab, krb5_keyblock *keys; int code, nkeys, i; - (void) memset((char *)&princ_rec, 0, sizeof(princ_rec)); + (void) memset(&princ_rec, 0, sizeof(princ_rec)); princ = NULL; keys = NULL; @@ -309,7 +309,7 @@ int add_principal(void *lhandle, char *keytab_str, krb5_keytab keytab, } for (i = 0; i < nkeys; i++) { - memset((char *) &new_entry, 0, sizeof(new_entry)); + memset(&new_entry, 0, sizeof(new_entry)); new_entry.principal = princ; new_entry.key = keys[i]; new_entry.vno = princ_rec.kvno; diff --git a/src/kadmin/dbutil/dump.c b/src/kadmin/dbutil/dump.c index 55677f7a5..8dab4605c 100644 --- a/src/kadmin/dbutil/dump.c +++ b/src/kadmin/dbutil/dump.c @@ -1493,7 +1493,7 @@ process_k5beta_record(fname, kcontext, filep, verbose, linenop) try2read = (char *) NULL; (*linenop)++; retval = 1; - memset((char *)&dbent, 0, sizeof(dbent)); + memset(&dbent, 0, sizeof(dbent)); /* Make sure we've got key_data entries */ if (krb5_dbe_create_key_data(kcontext, &dbent) || @@ -1794,7 +1794,7 @@ process_k5beta6_record(fname, kcontext, filep, verbose, linenop) const char *try2read; try2read = (char *) NULL; - memset((char *) &dbentry, 0, sizeof(dbentry)); + memset(&dbentry, 0, sizeof(dbentry)); (*linenop)++; retval = 1; name = (char *) NULL; diff --git a/src/kadmin/dbutil/kdb5_create.c b/src/kadmin/dbutil/kdb5_create.c index 6a638a351..e8e489729 100644 --- a/src/kadmin/dbutil/kdb5_create.c +++ b/src/kadmin/dbutil/kdb5_create.c @@ -349,7 +349,7 @@ master key name '%s'\n", } /* clean up */ (void) krb5_db_fini(util_context); - memset((char *)master_keyblock.contents, 0, master_keyblock.length); + memset(master_keyblock.contents, 0, master_keyblock.length); free(master_keyblock.contents); if (pw_str) { memset(pw_str, 0, pw_size); @@ -426,7 +426,7 @@ add_principal(context, princ, op, pblock) int nentries = 1; krb5_actkvno_node actkvno; - memset((char *) &entry, 0, sizeof(entry)); + memset(&entry, 0, sizeof(entry)); entry.len = KRB5_KDB_V1_BASE_LENGTH; entry.attributes = pblock->flags; @@ -449,7 +449,7 @@ add_principal(context, princ, op, pblock) if ((entry.key_data=(krb5_key_data*)malloc(sizeof(krb5_key_data))) == NULL) goto error_out; - memset((char *) entry.key_data, 0, sizeof(krb5_key_data)); + memset(entry.key_data, 0, sizeof(krb5_key_data)); entry.n_key_data = 1; if (global_params.mask & KADM5_CONFIG_KVNO) diff --git a/src/kadmin/dbutil/kdb5_mkey.c b/src/kadmin/dbutil/kdb5_mkey.c index 786726e63..48bbd5533 100644 --- a/src/kadmin/dbutil/kdb5_mkey.c +++ b/src/kadmin/dbutil/kdb5_mkey.c @@ -99,7 +99,7 @@ add_new_mkey(krb5_context context, krb5_db_entry *master_entry, if (master_entry->key_data == NULL) return (ENOMEM); - memset((char *) master_entry->key_data, 0, + memset(master_entry->key_data, 0, sizeof(krb5_key_data) * (old_key_data_count + 1)); master_entry->n_key_data = old_key_data_count + 1; @@ -1308,7 +1308,7 @@ kdb5_purge_mkeys(int argc, char *argv[]) exit_status++; return; } - memset((char *) master_entry.key_data, 0, sizeof(krb5_key_data) * num_kvnos_inuse); + memset(master_entry.key_data, 0, sizeof(krb5_key_data) * num_kvnos_inuse); master_entry.n_key_data = num_kvnos_inuse; /* there's only 1 mkey per kvno */ /* diff --git a/src/kadmin/dbutil/kdb5_util.c b/src/kadmin/dbutil/kdb5_util.c index 6cb70c1cd..1b0d5a492 100644 --- a/src/kadmin/dbutil/kdb5_util.c +++ b/src/kadmin/dbutil/kdb5_util.c @@ -519,7 +519,7 @@ static int open_db_and_mkey() if ((retval = krb5_c_random_seed(util_context, &seed))) { com_err(progname, retval, "while seeding random number generator"); exit_status++; - memset((char *)master_keyblock.contents, 0, master_keyblock.length); + memset(master_keyblock.contents, 0, master_keyblock.length); krb5_free_keyblock_contents(util_context, &master_keyblock); krb5_db_free_mkey_list(util_context, master_keylist); return(1); @@ -544,7 +544,7 @@ quit() return 0; krb5_db_free_mkey_list(util_context, master_keylist); retval = krb5_db_fini(util_context); - memset((char *)master_keyblock.contents, 0, master_keyblock.length); + memset(master_keyblock.contents, 0, master_keyblock.length); finished = TRUE; if (retval && retval != KRB5_KDB_DBNOTINITED) { com_err(progname, retval, "while closing database"); diff --git a/src/kadmin/ktutil/ktutil_funcs.c b/src/kadmin/ktutil/ktutil_funcs.c index c39448c20..6fa2a3025 100644 --- a/src/kadmin/ktutil/ktutil_funcs.c +++ b/src/kadmin/ktutil/ktutil_funcs.c @@ -131,7 +131,7 @@ krb5_error_code ktutil_add(context, list, princ_str, kvno, if (!entry) { return ENOMEM; } - memset((char *) entry, 0, sizeof(*entry)); + memset(entry, 0, sizeof(*entry)); if (!lp) { /* if list is empty, start one */ lp = (krb5_kt_list) malloc(sizeof(*lp)); @@ -258,7 +258,7 @@ krb5_error_code ktutil_read_keytab(context, name, list) retval = ENOMEM; break; } - memset((char *)entry, 0, sizeof (*entry)); + memset(entry, 0, sizeof (*entry)); retval = krb5_kt_next_entry(context, kt, entry, &cursor); if (retval) break; diff --git a/src/kadmin/server/ipropd_svc.c b/src/kadmin/server/ipropd_svc.c index e00701b0c..9140bbdc4 100644 --- a/src/kadmin/server/ipropd_svc.c +++ b/src/kadmin/server/ipropd_svc.c @@ -542,7 +542,7 @@ krb5_iprop_prog_1(struct svc_req *rqstp, svcerr_noproc(transp); return; } - (void) memset((char *)&argument, 0, sizeof (argument)); + (void) memset(&argument, 0, sizeof (argument)); if (!svc_getargs(transp, _xdr_argument, (caddr_t)&argument)) { krb5_klog_syslog(LOG_ERR, _("RPC svc_getargs failed (%s)"), diff --git a/src/kadmin/server/kadm_rpc_svc.c b/src/kadmin/server/kadm_rpc_svc.c index cba42a48c..280cf4444 100644 --- a/src/kadmin/server/kadm_rpc_svc.c +++ b/src/kadmin/server/kadm_rpc_svc.c @@ -217,7 +217,7 @@ void kadm_1(rqstp, transp) svcerr_noproc(transp); return; } - memset((char *)&argument, 0, sizeof(argument)); + memset(&argument, 0, sizeof(argument)); if (!svc_getargs(transp, xdr_argument, &argument)) { svcerr_decode(transp); return; diff --git a/src/kadmin/server/ovsec_kadmd.c b/src/kadmin/server/ovsec_kadmd.c index 81e74758f..97d714428 100644 --- a/src/kadmin/server/ovsec_kadmd.c +++ b/src/kadmin/server/ovsec_kadmd.c @@ -248,7 +248,7 @@ int main(int argc, char *argv[]) nofork = 0; - memset((char *) ¶ms, 0, sizeof(params)); + memset(¶ms, 0, sizeof(params)); argc--; argv++; while (argc) { diff --git a/src/kdc/kdc_util.c b/src/kdc/kdc_util.c index 140ba78b6..00ae43645 100644 --- a/src/kdc/kdc_util.c +++ b/src/kdc/kdc_util.c @@ -150,9 +150,7 @@ concat_authorization_data(krb5_authdata **first, krb5_authdata **second, krb5_free_authdata(kdc_context, retdata); return ENOMEM; } - memcpy((char *) retdata[i]->contents, - (char *)(*ptr)->contents, - retdata[i]->length); + memcpy(retdata[i]->contents, (*ptr)->contents, retdata[i]->length); ptr++; i++; diff --git a/src/kdc/main.c b/src/kdc/main.c index 91d781404..dd601c1c5 100644 --- a/src/kdc/main.c +++ b/src/kdc/main.c @@ -165,7 +165,7 @@ finish_realm(kdc_realm_t *rdp) krb5_free_principal(rdp->realm_context, rdp->realm_tgsprinc); krb5_free_context(rdp->realm_context); } - memset((char *) rdp, 0, sizeof(*rdp)); + memset(rdp, 0, sizeof(*rdp)); free(rdp); } @@ -247,7 +247,7 @@ init_realm(char *progname, kdc_realm_t *rdp, char *realm, int kdb_open_flags; krb5_kvno mkvno = IGNORE_VNO; - memset((char *) rdp, 0, sizeof(kdc_realm_t)); + memset(rdp, 0, sizeof(kdc_realm_t)); if (!realm) { kret = EINVAL; goto whoops; @@ -814,7 +814,7 @@ int main(int argc, char **argv) fprintf(stderr, "%s: cannot get memory for realm list\n", argv[0]); exit(1); } - memset((char *) kdc_realmlist, 0, + memset(kdc_realmlist, 0, (size_t) (sizeof(kdc_realm_t *) * KRB5_KDC_MAX_REALMS)); /* diff --git a/src/lib/crypto/des/afsstring2key.c b/src/lib/crypto/des/afsstring2key.c index 571dab007..eb6c37f33 100644 --- a/src/lib/crypto/des/afsstring2key.c +++ b/src/lib/crypto/des/afsstring2key.c @@ -142,7 +142,7 @@ mit_afs_string_to_key (krb5_keyblock *keyblock, const krb5_data *data, (void) mit_des_cbc_cksum (password, key, i, key_sked, ikey); /* erase key_sked */ - memset((char *)key_sked, 0,sizeof(key_sked)); + memset(key_sked, 0,sizeof(key_sked)); /* now fix up key parity again */ mit_des_fixup_key_parity(key); diff --git a/src/lib/gssapi/generic/gssapiP_generic.h b/src/lib/gssapi/generic/gssapiP_generic.h index b684055c4..cb2340a4b 100644 --- a/src/lib/gssapi/generic/gssapiP_generic.h +++ b/src/lib/gssapi/generic/gssapiP_generic.h @@ -75,7 +75,7 @@ typedef UINT64_TYPE gssint_uint64; (ptr) += 2; #define TWRITE_STR(ptr, str, len) \ - memcpy((ptr), (char *) (str), (len)); \ + memcpy((ptr), (str), (len)); \ (ptr) += (len); #define TREAD_STR(ptr, str, len) \ diff --git a/src/lib/gssapi/krb5/init_sec_context.c b/src/lib/gssapi/krb5/init_sec_context.c index f91c7525e..631cbe080 100644 --- a/src/lib/gssapi/krb5/init_sec_context.c +++ b/src/lib/gssapi/krb5/init_sec_context.c @@ -131,7 +131,7 @@ static krb5_error_code get_credentials(context, cred, server, now, krb5_creds in_creds; k5_mutex_assert_locked(&cred->lock); - memset((char *) &in_creds, 0, sizeof(krb5_creds)); + memset(&in_creds, 0, sizeof(krb5_creds)); in_creds.client = in_creds.server = NULL; if ((code = krb5_copy_principal(context, cred->princ, &in_creds.client))) diff --git a/src/lib/gssapi/krb5/util_crypt.c b/src/lib/gssapi/krb5/util_crypt.c index a8558a594..a800c1582 100644 --- a/src/lib/gssapi/krb5/util_crypt.c +++ b/src/lib/gssapi/krb5/util_crypt.c @@ -345,10 +345,10 @@ kg_arcfour_docrypt (const krb5_keyblock *longterm_key , int ms_usage, &seq_enc_key, 0, &input, &output)); cleanup_arcfour: - memset ((void *) seq_enc_key.contents, 0, seq_enc_key.length); - memset ((void *) usage_key.contents, 0, usage_key.length); - free ((void *) usage_key.contents); - free ((void *) seq_enc_key.contents); + memset (seq_enc_key.contents, 0, seq_enc_key.length); + memset (usage_key.contents, 0, usage_key.length); + free (usage_key.contents); + free (seq_enc_key.contents); return (code); } @@ -713,10 +713,10 @@ kg_arcfour_docrypt_iov (krb5_context context, &seq_enc_key, 0, kiov, kiov_count)); cleanup_arcfour: - memset ((void *) seq_enc_key.contents, 0, seq_enc_key.length); - memset ((void *) usage_key.contents, 0, usage_key.length); - free ((void *) usage_key.contents); - free ((void *) seq_enc_key.contents); + memset (seq_enc_key.contents, 0, seq_enc_key.length); + memset (usage_key.contents, 0, usage_key.length); + free (usage_key.contents); + free (seq_enc_key.contents); if (kiov != NULL) free(kiov); return (code); diff --git a/src/lib/gssapi/spnego/spnego_mech.c b/src/lib/gssapi/spnego/spnego_mech.c index 5321de0be..3a6653caf 100644 --- a/src/lib/gssapi/spnego/spnego_mech.c +++ b/src/lib/gssapi/spnego/spnego_mech.c @@ -2374,7 +2374,7 @@ put_mech_oid(unsigned char **buf_out, gss_OID_const mech, unsigned int buflen) return (-1); *(*buf_out)++ = MECH_OID; *(*buf_out)++ = (unsigned char) mech->length; - memcpy((void *)(*buf_out), mech->elements, mech->length); + memcpy(*buf_out, mech->elements, mech->length); *buf_out += mech->length; return (0); } diff --git a/src/lib/kadm5/alt_prof.c b/src/lib/kadm5/alt_prof.c index 7ad59ab4d..497eb6636 100644 --- a/src/lib/kadm5/alt_prof.c +++ b/src/lib/kadm5/alt_prof.c @@ -525,8 +525,8 @@ krb5_error_code kadm5_get_config_params(context, use_kdc_config, krb5_error_code kret = 0; - memset((char *) ¶ms, 0, sizeof(params)); - memset((char *) &empty_params, 0, sizeof(empty_params)); + memset(¶ms, 0, sizeof(params)); + memset(&empty_params, 0, sizeof(empty_params)); if (params_in == NULL) params_in = &empty_params; @@ -952,7 +952,7 @@ krb5_read_realm_params(kcontext, realm, rparamp) } /* Initialize realm parameters */ - memset((char *) rparams, 0, sizeof(krb5_realm_params)); + memset(rparams, 0, sizeof(krb5_realm_params)); /* Get the value for the database */ hierarchy[0] = "realms"; diff --git a/src/lib/kadm5/clnt/client_init.c b/src/lib/kadm5/clnt/client_init.c index 82bec3c4e..4395453b7 100644 --- a/src/lib/kadm5/clnt/client_init.c +++ b/src/lib/kadm5/clnt/client_init.c @@ -230,7 +230,7 @@ static kadm5_ret_t _kadm5_init_any(char *client_name, * of params_in. So use that realm, make params_in contain an * empty mask, and behave like version 2. */ - memset((char *) ¶ms_local, 0, sizeof(params_local)); + memset(¶ms_local, 0, sizeof(params_local)); if (api_version == KADM5_API_VERSION_1) { realm = params_local.realm = (char *) params_in; if (params_in) @@ -319,8 +319,7 @@ static kadm5_ret_t _kadm5_init_any(char *client_name, memset(&addr, 0, sizeof(addr)); addr.sin_family = hp->h_addrtype; - (void) memcpy((char *) &addr.sin_addr, (char *) hp->h_addr, - sizeof(addr.sin_addr)); + (void) memcpy(&addr.sin_addr, hp->h_addr, sizeof(addr.sin_addr)); if (iprop_enable) addr.sin_port = htons((u_short) handle->params.iprop_port); else diff --git a/src/lib/kadm5/clnt/client_rpc.c b/src/lib/kadm5/clnt/client_rpc.c index 28d9b6b7c..19c8b4703 100644 --- a/src/lib/kadm5/clnt/client_rpc.c +++ b/src/lib/kadm5/clnt/client_rpc.c @@ -16,7 +16,7 @@ create_principal_2(cprinc_arg *argp, CLIENT *clnt) { static generic_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, CREATE_PRINCIPAL, (xdrproc_t) xdr_cprinc_arg, (caddr_t) argp, (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res, @@ -31,7 +31,7 @@ create_principal3_2(cprinc3_arg *argp, CLIENT *clnt) { static generic_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, CREATE_PRINCIPAL3, (xdrproc_t) xdr_cprinc3_arg, (caddr_t) argp, (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res, @@ -46,7 +46,7 @@ delete_principal_2(dprinc_arg *argp, CLIENT *clnt) { static generic_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, DELETE_PRINCIPAL, (xdrproc_t) xdr_dprinc_arg, (caddr_t) argp, (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res, @@ -61,7 +61,7 @@ modify_principal_2(mprinc_arg *argp, CLIENT *clnt) { static generic_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, MODIFY_PRINCIPAL, (xdrproc_t) xdr_mprinc_arg, (caddr_t) argp, (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res, @@ -76,7 +76,7 @@ rename_principal_2(rprinc_arg *argp, CLIENT *clnt) { static generic_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, RENAME_PRINCIPAL, (xdrproc_t) xdr_rprinc_arg, (caddr_t) argp, (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res, @@ -91,7 +91,7 @@ get_principal_2(gprinc_arg *argp, CLIENT *clnt) { static gprinc_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, GET_PRINCIPAL, (xdrproc_t) xdr_gprinc_arg, (caddr_t) argp, (xdrproc_t) xdr_gprinc_ret, (caddr_t) &clnt_res, @@ -106,7 +106,7 @@ get_princs_2(gprincs_arg *argp, CLIENT *clnt) { static gprincs_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, GET_PRINCS, (xdrproc_t) xdr_gprincs_arg, (caddr_t) argp, (xdrproc_t) xdr_gprincs_ret, (caddr_t) &clnt_res, @@ -121,7 +121,7 @@ chpass_principal_2(chpass_arg *argp, CLIENT *clnt) { static generic_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, CHPASS_PRINCIPAL, (xdrproc_t) xdr_chpass_arg, (caddr_t) argp, (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res, @@ -136,7 +136,7 @@ chpass_principal3_2(chpass3_arg *argp, CLIENT *clnt) { static generic_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, CHPASS_PRINCIPAL3, (xdrproc_t) xdr_chpass3_arg, (caddr_t) argp, (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res, @@ -151,7 +151,7 @@ setv4key_principal_2(setv4key_arg *argp, CLIENT *clnt) { static generic_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, SETV4KEY_PRINCIPAL, (xdrproc_t) xdr_setv4key_arg, (caddr_t) argp, (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res, @@ -166,7 +166,7 @@ setkey_principal_2(setkey_arg *argp, CLIENT *clnt) { static generic_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, SETKEY_PRINCIPAL, (xdrproc_t) xdr_setkey_arg, (caddr_t) argp, (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res, @@ -181,7 +181,7 @@ setkey_principal3_2(setkey3_arg *argp, CLIENT *clnt) { static generic_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, SETKEY_PRINCIPAL3, (xdrproc_t) xdr_setkey3_arg, (caddr_t) argp, (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res, @@ -196,7 +196,7 @@ chrand_principal_2(chrand_arg *argp, CLIENT *clnt) { static chrand_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, CHRAND_PRINCIPAL, (xdrproc_t) xdr_chrand_arg, (caddr_t) argp, (xdrproc_t) xdr_chrand_ret, (caddr_t) &clnt_res, @@ -211,7 +211,7 @@ chrand_principal3_2(chrand3_arg *argp, CLIENT *clnt) { static chrand_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, CHRAND_PRINCIPAL3, (xdrproc_t) xdr_chrand3_arg, (caddr_t) argp, (xdrproc_t) xdr_chrand_ret, (caddr_t) &clnt_res, @@ -226,7 +226,7 @@ create_policy_2(cpol_arg *argp, CLIENT *clnt) { static generic_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, CREATE_POLICY, (xdrproc_t) xdr_cpol_arg, (caddr_t) argp, (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res, @@ -241,7 +241,7 @@ delete_policy_2(dpol_arg *argp, CLIENT *clnt) { static generic_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, DELETE_POLICY, (xdrproc_t) xdr_dpol_arg, (caddr_t) argp, (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res, @@ -256,7 +256,7 @@ modify_policy_2(mpol_arg *argp, CLIENT *clnt) { static generic_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, MODIFY_POLICY, (xdrproc_t) xdr_mpol_arg, (caddr_t) argp, (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res, @@ -271,7 +271,7 @@ get_policy_2(gpol_arg *argp, CLIENT *clnt) { static gpol_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, GET_POLICY, (xdrproc_t) xdr_gpol_arg, (caddr_t) argp, (xdrproc_t) xdr_gpol_ret, (caddr_t) &clnt_res, @@ -286,7 +286,7 @@ get_pols_2(gpols_arg *argp, CLIENT *clnt) { static gpols_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, GET_POLS, (xdrproc_t) xdr_gpols_arg, (caddr_t) argp, (xdrproc_t) xdr_gpols_ret, (caddr_t) &clnt_res, @@ -301,7 +301,7 @@ get_privs_2(void *argp, CLIENT *clnt) { static getprivs_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, GET_PRIVS, (xdrproc_t) xdr_u_int32, (caddr_t) argp, (xdrproc_t) xdr_getprivs_ret, (caddr_t) &clnt_res, @@ -316,7 +316,7 @@ init_2(void *argp, CLIENT *clnt) { static generic_ret clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call(clnt, INIT, (xdrproc_t) xdr_u_int32, (caddr_t) argp, (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res, diff --git a/src/lib/kadm5/kadm_rpc_xdr.c b/src/lib/kadm5/kadm_rpc_xdr.c index d760ff14d..7f283f2d0 100644 --- a/src/lib/kadm5/kadm_rpc_xdr.c +++ b/src/lib/kadm5/kadm_rpc_xdr.c @@ -230,7 +230,7 @@ bool_t xdr_krb5_key_data_nocontents(XDR *xdrs, krb5_key_data *objp) unsigned int tmp; if (xdrs->x_op == XDR_DECODE) - memset((char *) objp, 0, sizeof(krb5_key_data)); + memset(objp, 0, sizeof(krb5_key_data)); if (!xdr_krb5_int16(xdrs, &objp->key_data_ver)) { return (FALSE); @@ -322,7 +322,7 @@ bool_t xdr_krb5_tl_data(XDR *xdrs, krb5_tl_data **tl_data_head) tl2 = (krb5_tl_data *) malloc(sizeof(krb5_tl_data)); if (tl2 == NULL) return FALSE; - memset((char *) tl2, 0, sizeof(krb5_tl_data)); + memset(tl2, 0, sizeof(krb5_tl_data)); if (!xdr_krb5_int16(xdrs, &tl2->tl_data_type)) return FALSE; if (!xdr_bytes(xdrs, (char **)&tl2->tl_data_contents, &len, ~0)) diff --git a/src/lib/kadm5/srv/server_acl.c b/src/lib/kadm5/srv/server_acl.c index 9471d0ac0..88a517a00 100644 --- a/src/lib/kadm5/srv/server_acl.c +++ b/src/lib/kadm5/srv/server_acl.c @@ -607,7 +607,7 @@ kadm5int_acl_find_entry(kcontext, principal, dest_princ) wildstate_t state; DPRINT(DEBUG_CALLS, acl_debug_level, ("* kadm5int_acl_find_entry()\n")); - memset((char *)&state, 0, sizeof state); + memset(&state, 0, sizeof state); for (entry=acl_list_head; entry; entry = entry->ae_next) { if (entry->ae_name_bad) continue; diff --git a/src/lib/kadm5/srv/server_init.c b/src/lib/kadm5/srv/server_init.c index febf79bdf..77a83ba60 100644 --- a/src/lib/kadm5/srv/server_init.c +++ b/src/lib/kadm5/srv/server_init.c @@ -210,7 +210,7 @@ kadm5_ret_t kadm5_init(char *client_name, char *pass, * of params_in. So use that realm, make params_in contain an * empty mask, and behave like version 2. */ - memset((char *) ¶ms_local, 0, sizeof(params_local)); + memset(¶ms_local, 0, sizeof(params_local)); if (api_version == KADM5_API_VERSION_1) { params_local.realm = (char *) params_in; if (params_in) diff --git a/src/lib/kadm5/srv/svr_principal.c b/src/lib/kadm5/srv/svr_principal.c index 207143710..c44463bf7 100644 --- a/src/lib/kadm5/srv/svr_principal.c +++ b/src/lib/kadm5/srv/svr_principal.c @@ -764,7 +764,7 @@ kadm5_get_principal(void *server_handle, krb5_principal principal, mask = in_mask; } - memset((char *) entry, 0, sizeof(*entry)); + memset(entry, 0, sizeof(*entry)); if (principal == NULL) return EINVAL; @@ -1184,7 +1184,7 @@ static kadm5_ret_t add_to_history(krb5_context context, } free(histp->key_data); } - free((void *)adb->old_keys); + free(adb->old_keys); adb->old_keys = tmp; nkeys = adb->old_key_len = nhist - 1; knext = adb->old_key_next = 0; @@ -2155,7 +2155,7 @@ static int decrypt_key_data(krb5_context context, krb5_keyblock *mkey, keys = (krb5_keyblock *) malloc(n_key_data*sizeof(krb5_keyblock)); if (keys == NULL) return ENOMEM; - memset((char *) keys, 0, n_key_data*sizeof(krb5_keyblock)); + memset(keys, 0, n_key_data*sizeof(krb5_keyblock)); for (i = 0; i < n_key_data; i++) { ret = krb5_dbekd_decrypt_key_data(context, mkey, @@ -2169,7 +2169,7 @@ static int decrypt_key_data(krb5_context context, krb5_keyblock *mkey, } } - memset((char *) keys, 0, n_key_data*sizeof(krb5_keyblock)); + memset(keys, 0, n_key_data*sizeof(krb5_keyblock)); free(keys); return ret; } diff --git a/src/lib/kadm5/unit-test/setkey-test.c b/src/lib/kadm5/unit-test/setkey-test.c index 865fc14b7..b0dcd0e7e 100644 --- a/src/lib/kadm5/unit-test/setkey-test.c +++ b/src/lib/kadm5/unit-test/setkey-test.c @@ -84,7 +84,7 @@ main(int argc, char **argv) * to kadm5 server. */ - memset((char *) &context, 0, sizeof(context)); + memset(&context, 0, sizeof(context)); kadm5_init_krb5_context(&context); ret = krb5_parse_name(context, principal, &princ); @@ -174,7 +174,7 @@ main(int argc, char **argv) for (encnum = 0; testp[encnum].magic != -1; encnum++) { printf("+ enctype %d\n", testp[encnum].enctype); - memset((char *) &ktent, 0, sizeof(ktent)); + memset(&ktent, 0, sizeof(ktent)); ktent.principal = princ; ktent.key = testp[encnum]; ktent.vno = princ_ent.kvno; @@ -185,7 +185,7 @@ main(int argc, char **argv) exit(1); } - memset((char *)&my_creds, 0, sizeof(my_creds)); + memset(&my_creds, 0, sizeof(my_creds)); my_creds.client = princ; my_creds.server = server; diff --git a/src/lib/kdb/kdb_cpw.c b/src/lib/kdb/kdb_cpw.c index 2062055d0..9f1f2b14e 100644 --- a/src/lib/kdb/kdb_cpw.c +++ b/src/lib/kdb/kdb_cpw.c @@ -449,8 +449,8 @@ add_key_pwd(context, master_key, ks_tuple, ks_tuple_count, passwd, if(!(key_salt.data.data = (char *) malloc(slen+1))) return ENOMEM; key_salt.data.data[slen] = 0; - memcpy((char *)key_salt.data.data, - (char *)(*krb5_princ_realm(context,db_entry->princ)).data, + memcpy(key_salt.data.data, + (*krb5_princ_realm(context,db_entry->princ)).data, slen); key_salt.data.length = SALT_TYPE_AFS_LENGTH; /*length actually used below...*/ #endif diff --git a/src/lib/kdb/kdb_default.c b/src/lib/kdb/kdb_default.c index df8791624..098879d93 100644 --- a/src/lib/kdb/kdb_default.c +++ b/src/lib/kdb/kdb_default.c @@ -204,7 +204,7 @@ krb5_def_store_mkey_list(krb5_context context, goto out; while (keylist && !retval) { - memset((char *) &new_entry, 0, sizeof(new_entry)); + memset(&new_entry, 0, sizeof(new_entry)); new_entry.principal = mname; new_entry.key = keylist->keyblock; new_entry.vno = keylist->kvno; diff --git a/src/lib/krb5/asn.1/asn1glue.h b/src/lib/krb5/asn.1/asn1glue.h index 48cdc7429..9ec10ebc8 100644 --- a/src/lib/krb5/asn.1/asn1glue.h +++ b/src/lib/krb5/asn.1/asn1glue.h @@ -40,7 +40,6 @@ #define KRB5_APOptions2krb5_apoptions(val, err) KRB5_TicketFlags2krb5_flags((struct type_KRB5_APOptions *) (val), err) /* to keep lint happy */ -#define xbcopy(src,dst,size) memcpy((char *)(dst), (char *)(src), size) #define xmalloc(n) malloc((unsigned) (n)) #define xcalloc(n,s) calloc((unsigned)(n), (unsigned)(s)) diff --git a/src/lib/krb5/ccache/cc_file.c b/src/lib/krb5/ccache/cc_file.c index d8257a231..9b7280b48 100644 --- a/src/lib/krb5/ccache/cc_file.c +++ b/src/lib/krb5/ccache/cc_file.c @@ -1891,7 +1891,7 @@ krb5_fcc_next_cred(krb5_context context, krb5_ccache id, krb5_cc_cursor *cursor, if (kret) return kret; - memset((char *)creds, 0, sizeof(*creds)); + memset(creds, 0, sizeof(*creds)); MAYBE_OPEN(context, id, FCC_OPEN_RDONLY); fcursor = (krb5_fcc_cursor *) *cursor; diff --git a/src/lib/krb5/krb/auth_con.c b/src/lib/krb5/krb/auth_con.c index 40b3d95d0..ea4ef3a0c 100644 --- a/src/lib/krb5/krb/auth_con.c +++ b/src/lib/krb5/krb/auth_con.c @@ -15,7 +15,7 @@ actx_copy_addr(krb5_context context, const krb5_address *inad, krb5_address **ou free(tmpad); return ENOMEM; } - memcpy((char *)tmpad->contents, (char *)inad->contents, inad->length); + memcpy(tmpad->contents, inad->contents, inad->length); *outad = tmpad; return 0; } diff --git a/src/lib/krb5/krb/copy_addrs.c b/src/lib/krb5/krb/copy_addrs.c index f3f75c33b..c3dcd57d0 100644 --- a/src/lib/krb5/krb/copy_addrs.c +++ b/src/lib/krb5/krb/copy_addrs.c @@ -41,7 +41,7 @@ krb5_copy_addr(krb5_context context, const krb5_address *inad, krb5_address **ou free(tmpad); return ENOMEM; } - memcpy((char *)tmpad->contents, (char *)inad->contents, inad->length); + memcpy(tmpad->contents, inad->contents, inad->length); *outad = tmpad; return 0; } diff --git a/src/lib/krb5/krb/copy_auth.c b/src/lib/krb5/krb/copy_auth.c index 9a94cdded..e9472eec8 100644 --- a/src/lib/krb5/krb/copy_auth.c +++ b/src/lib/krb5/krb/copy_auth.c @@ -68,7 +68,7 @@ krb5_copy_authdatum(krb5_context context, const krb5_authdata *inad, krb5_authda free(tmpad); return ENOMEM; } - memcpy((char *)tmpad->contents, (char *)inad->contents, inad->length); + memcpy(tmpad->contents, inad->contents, inad->length); *outad = tmpad; return 0; } diff --git a/src/lib/krb5/krb/copy_cksum.c b/src/lib/krb5/krb/copy_cksum.c index 2bff2c36e..c7c1b161c 100644 --- a/src/lib/krb5/krb/copy_cksum.c +++ b/src/lib/krb5/krb/copy_cksum.c @@ -38,13 +38,11 @@ krb5_copy_checksum(krb5_context context, const krb5_checksum *ckfrom, krb5_check return ENOMEM; *tempto = *ckfrom; - if (!(tempto->contents = - (krb5_octet *)malloc(tempto->length))) { + if (!(tempto->contents = (krb5_octet *)malloc(tempto->length))) { free(tempto); return ENOMEM; } - memcpy((char *) tempto->contents, (char *) ckfrom->contents, - ckfrom->length); + memcpy(tempto->contents, ckfrom->contents, ckfrom->length); *ckto = tempto; return 0; diff --git a/src/lib/krb5/krb/copy_data.c b/src/lib/krb5/krb/copy_data.c index 5ba90c6b9..41032cca5 100644 --- a/src/lib/krb5/krb/copy_data.c +++ b/src/lib/krb5/krb/copy_data.c @@ -68,7 +68,7 @@ krb5int_copy_data_contents(krb5_context context, const krb5_data *indata, krb5_d if (!(outdata->data = malloc(outdata->length))) { return ENOMEM; } - memcpy((char *)outdata->data, (char *)indata->data, outdata->length); + memcpy(outdata->data, indata->data, outdata->length); } else outdata->data = 0; outdata->magic = KV5M_DATA; diff --git a/src/lib/krb5/krb/copy_key.c b/src/lib/krb5/krb/copy_key.c index e7fc2772a..f926b4f36 100644 --- a/src/lib/krb5/krb/copy_key.c +++ b/src/lib/krb5/krb/copy_key.c @@ -44,8 +44,7 @@ krb5_copy_keyblock(krb5_context context, const krb5_keyblock *from, krb5_keybloc free(new_key); return(ENOMEM); } - memcpy((char *)new_key->contents, (char *)from->contents, - new_key->length); + memcpy(new_key->contents, from->contents, new_key->length); *to = new_key; return 0; } diff --git a/src/lib/krb5/krb/copy_tick.c b/src/lib/krb5/krb/copy_tick.c index 76d8bcfac..1dc3362d0 100644 --- a/src/lib/krb5/krb/copy_tick.c +++ b/src/lib/krb5/krb/copy_tick.c @@ -62,7 +62,7 @@ krb5_copy_enc_tkt_part(krb5_context context, const krb5_enc_tkt_part *partfrom, free(tempto); return ENOMEM; } - memcpy((char *)tempto->transited.tr_contents.data, + memcpy(tempto->transited.tr_contents.data, (char *)partfrom->transited.tr_contents.data, partfrom->transited.tr_contents.length); } diff --git a/src/lib/krb5/krb/cp_key_cnt.c b/src/lib/krb5/krb/cp_key_cnt.c index 150be0a57..fb90bfac1 100644 --- a/src/lib/krb5/krb/cp_key_cnt.c +++ b/src/lib/krb5/krb/cp_key_cnt.c @@ -40,7 +40,7 @@ krb5_copy_keyblock_contents(krb5_context context, const krb5_keyblock *from, krb to->contents = (krb5_octet *)malloc(to->length); if (!to->contents) return ENOMEM; - memcpy((char *)to->contents, (char *)from->contents, to->length); + memcpy(to->contents, from->contents, to->length); } else to->contents = 0; return 0; diff --git a/src/lib/krb5/krb/fwd_tgt.c b/src/lib/krb5/krb/fwd_tgt.c index ccaef4d88..08646da6e 100644 --- a/src/lib/krb5/krb/fwd_tgt.c +++ b/src/lib/krb5/krb/fwd_tgt.c @@ -57,8 +57,8 @@ krb5_fwd_tgt_creds(krb5_context context, krb5_auth_context auth_context, char *r krb5_keyblock *session_key; krb5_boolean old_use_conf_ktypes = context->use_conf_ktypes; - memset((char *)&creds, 0, sizeof(creds)); - memset((char *)&tgt, 0, sizeof(creds)); + memset(&creds, 0, sizeof(creds)); + memset(&tgt, 0, sizeof(creds)); if (cc == 0) { if ((retval = krb5int_cc_default(context, &cc))) diff --git a/src/lib/krb5/krb/get_creds.c b/src/lib/krb5/krb/get_creds.c index fff8b903b..c02ddedc6 100644 --- a/src/lib/krb5/krb/get_creds.c +++ b/src/lib/krb5/krb/get_creds.c @@ -54,7 +54,7 @@ krb5_get_credentials_core(krb5_context context, krb5_flags options, if (!in_creds || !in_creds->server || !in_creds->client) return EINVAL; - memset((char *)mcreds, 0, sizeof(krb5_creds)); + memset(mcreds, 0, sizeof(krb5_creds)); mcreds->magic = KV5M_CREDS; if (in_creds->times.endtime != 0) { mcreds->times.endtime = in_creds->times.endtime; @@ -122,7 +122,7 @@ krb5_get_credentials(krb5_context context, krb5_flags options, if ((ncreds = (krb5_creds *)malloc(sizeof(krb5_creds))) == NULL) return ENOMEM; - memset((char *)ncreds, 0, sizeof(krb5_creds)); + memset(ncreds, 0, sizeof(krb5_creds)); ncreds->magic = KV5M_CREDS; /* The caller is now responsible for cleaning up in_creds */ @@ -261,7 +261,7 @@ krb5_validate_or_renew_creds(krb5_context context, krb5_creds *creds, krb5_creds *out_creds = 0; /* for check before dereferencing below */ krb5_creds **tgts; - memset((char *)&in_creds, 0, sizeof(krb5_creds)); + memset(&in_creds, 0, sizeof(krb5_creds)); in_creds.server = NULL; tgts = NULL; diff --git a/src/lib/krb5/krb/get_in_tkt.c b/src/lib/krb5/krb/get_in_tkt.c index 52d17e0bb..5db253d71 100644 --- a/src/lib/krb5/krb/get_in_tkt.c +++ b/src/lib/krb5/krb/get_in_tkt.c @@ -428,7 +428,7 @@ cleanup: if (server) krb5_free_principal(context, server); if (creds->keyblock.contents) { - memset((char *)creds->keyblock.contents, 0, + memset(creds->keyblock.contents, 0, creds->keyblock.length); free(creds->keyblock.contents); creds->keyblock.contents = 0; diff --git a/src/lib/krb5/krb/kfree.c b/src/lib/krb5/krb/kfree.c index 6bf20c5a9..1774e6e6c 100644 --- a/src/lib/krb5/krb/kfree.c +++ b/src/lib/krb5/krb/kfree.c @@ -187,7 +187,7 @@ krb5_free_cred_contents(krb5_context context, krb5_creds *val) val->server = 0; } if (val->keyblock.contents) { - memset((char *)val->keyblock.contents, 0, val->keyblock.length); + memset(val->keyblock.contents, 0, val->keyblock.length); free(val->keyblock.contents); val->keyblock.contents = 0; } diff --git a/src/lib/krb5/krb/mk_priv.c b/src/lib/krb5/krb/mk_priv.c index e626872a0..1acffd5b4 100644 --- a/src/lib/krb5/krb/mk_priv.c +++ b/src/lib/krb5/krb/mk_priv.c @@ -119,7 +119,7 @@ krb5_mk_priv(krb5_context context, krb5_auth_context auth_context, krb5_replay_data replaydata; /* Clear replaydata block */ - memset((char *) &replaydata, 0, sizeof(krb5_replay_data)); + memset(&replaydata, 0, sizeof(krb5_replay_data)); /* Get keyblock */ if ((keyblock = auth_context->send_subkey) == NULL) diff --git a/src/lib/krb5/krb/mk_req.c b/src/lib/krb5/krb/mk_req.c index 2935e41b3..0fc1e7213 100644 --- a/src/lib/krb5/krb/mk_req.c +++ b/src/lib/krb5/krb/mk_req.c @@ -65,7 +65,7 @@ krb5_mk_req(krb5_context context, krb5_auth_context *auth_context, return retval; /* obtain ticket & session key */ - memset((char *)&creds, 0, sizeof(creds)); + memset(&creds, 0, sizeof(creds)); if ((retval = krb5_copy_principal(context, server, &creds.server))) goto cleanup_princ; diff --git a/src/lib/krb5/krb/mk_safe.c b/src/lib/krb5/krb/mk_safe.c index c2937ea03..d99b1a3d7 100644 --- a/src/lib/krb5/krb/mk_safe.c +++ b/src/lib/krb5/krb/mk_safe.c @@ -104,7 +104,7 @@ krb5_mk_safe_basic(krb5_context context, const krb5_data *userdata, cleanup_checksum: free(safe_checksum.contents); - memset((char *)scratch1->data, 0, scratch1->length); + memset(scratch1->data, 0, scratch1->length); krb5_free_data(context, scratch1); return retval; } @@ -119,7 +119,7 @@ krb5_mk_safe(krb5_context context, krb5_auth_context auth_context, krb5_replay_data replaydata; /* Clear replaydata block */ - memset((char *) &replaydata, 0, sizeof(krb5_replay_data)); + memset(&replaydata, 0, sizeof(krb5_replay_data)); /* Get keyblock */ if ((keyblock = auth_context->send_subkey) == NULL) diff --git a/src/lib/krb5/krb/rd_safe.c b/src/lib/krb5/krb/rd_safe.c index 938b4483d..a79ef7fdf 100644 --- a/src/lib/krb5/krb/rd_safe.c +++ b/src/lib/krb5/krb/rd_safe.c @@ -128,7 +128,7 @@ krb5_rd_safe_basic(krb5_context context, const krb5_data *inbuf, KRB5_KEYUSAGE_KRB_SAFE_CKSUM, scratch, his_cksum, &valid); - (void) memset((char *)scratch->data, 0, scratch->length); + (void) memset(scratch->data, 0, scratch->length); krb5_free_data(context, scratch); if (!valid) { diff --git a/src/lib/krb5/krb/recvauth.c b/src/lib/krb5/krb/recvauth.c index ab3e1e48a..ce9da1272 100644 --- a/src/lib/krb5/krb/recvauth.c +++ b/src/lib/krb5/krb/recvauth.c @@ -177,7 +177,7 @@ recvauth_common(krb5_context context, krb5_error error; const char *message; - memset((char *)&error, 0, sizeof(error)); + memset(&error, 0, sizeof(error)); krb5_us_timeofday(context, &error.stime, &error.susec); if(server) error.server = server; diff --git a/src/lib/krb5/krb/send_tgs.c b/src/lib/krb5/krb/send_tgs.c index ab136abb7..83914c498 100644 --- a/src/lib/krb5/krb/send_tgs.c +++ b/src/lib/krb5/krb/send_tgs.c @@ -147,7 +147,7 @@ krb5_send_tgs(krb5_context context, krb5_flags kdcoptions, if (!in_cred->ticket.length) return(KRB5_NO_TKT_SUPPLIED); - memset((char *)&tgsreq, 0, sizeof(tgsreq)); + memset(&tgsreq, 0, sizeof(tgsreq)); tgsreq.kdc_options = kdcoptions; tgsreq.server = (krb5_principal) sname; diff --git a/src/lib/krb5/krb/sendauth.c b/src/lib/krb5/krb/sendauth.c index a082b8258..67b9adde0 100644 --- a/src/lib/krb5/krb/sendauth.c +++ b/src/lib/krb5/krb/sendauth.c @@ -91,7 +91,7 @@ krb5_sendauth(krb5_context context, krb5_auth_context *auth_context, * If no credentials were provided, try getting it from the * credentials cache. */ - memset((char *)&creds, 0, sizeof(creds)); + memset(&creds, 0, sizeof(creds)); /* * See if we need to access the credentials cache diff --git a/src/lib/krb5/krb/t_ser.c b/src/lib/krb5/krb/t_ser.c index 1776a3f21..c92ce50c6 100644 --- a/src/lib/krb5/krb/t_ser.c +++ b/src/lib/krb5/krb/t_ser.c @@ -562,7 +562,7 @@ ser_cksum_test(krb5_context kcontext, int verbose) checksum.checksum_type = 123; checksum.length = sizeof(ckdata); checksum.contents = ckdata; - memcpy(ckdata, (char *) &stuff, sizeof(ckdata)); + memcpy(ckdata, &stuff, sizeof(ckdata)); if (!(kret = ser_data(verbose, "> checksum with data", (krb5_pointer) &checksum, KV5M_CHECKSUM))) { if (verbose) diff --git a/src/lib/krb5/os/full_ipadr.c b/src/lib/krb5/os/full_ipadr.c index 309c3b57f..795ce1e01 100644 --- a/src/lib/krb5/os/full_ipadr.c +++ b/src/lib/krb5/os/full_ipadr.c @@ -59,25 +59,25 @@ krb5_make_full_ipaddr(krb5_context context, krb5_int32 adr, marshal = retaddr->contents; temptype = htons(ADDRTYPE_INET); - (void) memcpy((char *)marshal, (char *)&temptype, sizeof(temptype)); + (void) memcpy(marshal, &temptype, sizeof(temptype)); marshal += sizeof(temptype); templength = htonl(sizeof(smushaddr)); - (void) memcpy((char *)marshal, (char *)&templength, sizeof(templength)); + (void) memcpy(marshal, &templength, sizeof(templength)); marshal += sizeof(templength); - (void) memcpy((char *)marshal, (char *)&smushaddr, sizeof(smushaddr)); + (void) memcpy(marshal, &smushaddr, sizeof(smushaddr)); marshal += sizeof(smushaddr); temptype = htons(ADDRTYPE_IPPORT); - (void) memcpy((char *)marshal, (char *)&temptype, sizeof(temptype)); + (void) memcpy(marshal, &temptype, sizeof(temptype)); marshal += sizeof(temptype); templength = htonl(sizeof(smushport)); - (void) memcpy((char *)marshal, (char *)&templength, sizeof(templength)); + (void) memcpy(marshal, &templength, sizeof(templength)); marshal += sizeof(templength); - (void) memcpy((char *)marshal, (char *)&smushport, sizeof(smushport)); + (void) memcpy(marshal, &smushport, sizeof(smushport)); marshal += sizeof(smushport); *outaddr = retaddr; diff --git a/src/lib/krb5/os/gen_port.c b/src/lib/krb5/os/gen_port.c index 4832cec19..681928aa5 100644 --- a/src/lib/krb5/os/gen_port.c +++ b/src/lib/krb5/os/gen_port.c @@ -41,7 +41,7 @@ krb5_gen_portaddr(krb5_context context, const krb5_address *addr, krb5_const_poi return KRB5_PROG_ATYPE_NOSUPP; port = *(const krb5_int16 *)ptr; - memcpy((char *)&adr, (char *)addr->contents, sizeof(adr)); + memcpy(&adr, addr->contents, sizeof(adr)); return krb5_make_full_ipaddr(context, adr, port, outaddr); #else return KRB5_PROG_ATYPE_NOSUPP; diff --git a/src/lib/krb5/os/mk_faddr.c b/src/lib/krb5/os/mk_faddr.c index a5cc99a65..d084ded67 100644 --- a/src/lib/krb5/os/mk_faddr.c +++ b/src/lib/krb5/os/mk_faddr.c @@ -64,7 +64,7 @@ krb5_make_fulladdr(krb5_context context, krb5_address *kaddr, krb5_address *kpor store_32_le(tmp32, marshal); marshal += 4; - (void) memcpy((char *)marshal, (char *)(kaddr->contents), kaddr->length); + (void) memcpy(marshal, kaddr->contents, kaddr->length); marshal += kaddr->length; tmp16 = kport->addrtype; @@ -77,7 +77,7 @@ krb5_make_fulladdr(krb5_context context, krb5_address *kaddr, krb5_address *kpor store_32_le(tmp32, marshal); marshal += 4; - (void) memcpy((char *)marshal, (char *)(kport->contents), kport->length); + (void) memcpy(marshal, kport->contents, kport->length); marshal += kport->length; return 0; } diff --git a/src/lib/krb5/os/port2ip.c b/src/lib/krb5/os/port2ip.c index 6b5838b85..984e65fa3 100644 --- a/src/lib/krb5/os/port2ip.c +++ b/src/lib/krb5/os/port2ip.c @@ -50,31 +50,31 @@ krb5_unpack_full_ipaddr(krb5_context context, const krb5_address *inaddr, krb5_i marshal = inaddr->contents; - (void) memcpy((char *)&temptype, (char *)marshal, sizeof(temptype)); + (void) memcpy(&temptype, marshal, sizeof(temptype)); marshal += sizeof(temptype); if (temptype != htons(ADDRTYPE_INET)) return KRB5_PROG_ATYPE_NOSUPP; - (void) memcpy((char *)&templength, (char *)marshal, sizeof(templength)); + (void) memcpy(&templength, marshal, sizeof(templength)); marshal += sizeof(templength); if (templength != htonl(sizeof(smushaddr))) return KRB5_PROG_ATYPE_NOSUPP; - (void) memcpy((char *)&smushaddr, (char *)marshal, sizeof(smushaddr)); + (void) memcpy(&smushaddr, marshal, sizeof(smushaddr)); /* leave in net order */ marshal += sizeof(smushaddr); - (void) memcpy((char *)&temptype, (char *)marshal, sizeof(temptype)); + (void) memcpy(&temptype, marshal, sizeof(temptype)); marshal += sizeof(temptype); if (temptype != htons(ADDRTYPE_IPPORT)) return KRB5_PROG_ATYPE_NOSUPP; - (void) memcpy((char *)&templength, (char *)marshal, sizeof(templength)); + (void) memcpy(&templength, marshal, sizeof(templength)); marshal += sizeof(templength); if (templength != htonl(sizeof(smushport))) return KRB5_PROG_ATYPE_NOSUPP; - (void) memcpy((char *)&smushport, (char *)marshal, sizeof(smushport)); + (void) memcpy(&smushport, marshal, sizeof(smushport)); /* leave in net order */ *adr = (krb5_int32) smushaddr; diff --git a/src/lib/rpc/auth_gssapi.c b/src/lib/rpc/auth_gssapi.c index 721115670..69a4fd1a4 100644 --- a/src/lib/rpc/auth_gssapi.c +++ b/src/lib/rpc/auth_gssapi.c @@ -176,8 +176,8 @@ AUTH *auth_gssapi_create( rpc_createerr.cf_error.re_errno = ENOMEM; goto cleanup; } - memset((char *) auth, 0, sizeof(*auth)); - memset((char *) pdata, 0, sizeof(*pdata)); + memset(auth, 0, sizeof(*auth)); + memset(pdata, 0, sizeof(*pdata)); auth->ah_ops = &auth_gssapi_ops; auth->ah_private = (caddr_t) pdata; @@ -246,7 +246,7 @@ try_new_version: bindp = NULL; } - memset((char *) &call_res, 0, sizeof(call_res)); + memset(&call_res, 0, sizeof(call_res)); next_token: *gssstat = gss_init_sec_context(minor_stat, @@ -283,7 +283,7 @@ next_token: PRINTF(("gssapi_create: calling GSSAPI_INIT (%d)\n", init_func)); - memset((char *) &call_res, 0, sizeof(call_res)); + memset(&call_res, 0, sizeof(call_res)); callstat = clnt_call(clnt, init_func, xdr_authgssapi_init_arg, &call_arg, xdr_authgssapi_init_res, &call_res, diff --git a/src/lib/rpc/get_myaddress.c b/src/lib/rpc/get_myaddress.c index 884a19b70..6ec017063 100644 --- a/src/lib/rpc/get_myaddress.c +++ b/src/lib/rpc/get_myaddress.c @@ -52,7 +52,7 @@ static char sccsid[] = "@(#)get_myaddress.c 1.4 87/08/11 Copyr 1984 Sun Micro"; int get_myaddress(struct sockaddr_in *addr) { - memset((void *) addr, 0, sizeof(*addr)); + memset(addr, 0, sizeof(*addr)); addr->sin_family = AF_INET; addr->sin_port = htons(PMAPPORT); addr->sin_addr.s_addr = htonl(INADDR_LOOPBACK); diff --git a/src/lib/rpc/svc_auth_gssapi.c b/src/lib/rpc/svc_auth_gssapi.c index e374f006b..e14a581a6 100644 --- a/src/lib/rpc/svc_auth_gssapi.c +++ b/src/lib/rpc/svc_auth_gssapi.c @@ -169,7 +169,7 @@ enum auth_stat gssrpc__svcauth_gssapi( /* use AUTH_NONE until there is a client_handle */ rqst->rq_xprt->xp_auth = &svc_auth_none; - memset((char *) &call_res, 0, sizeof(call_res)); + memset(&call_res, 0, sizeof(call_res)); creds.client_handle.length = 0; creds.client_handle.value = NULL; @@ -185,7 +185,7 @@ enum auth_stat gssrpc__svcauth_gssapi( PRINTF(("svcauth_gssapi: decoding credentials\n")); xdrmem_create(&xdrs, cred->oa_base, cred->oa_length, XDR_DECODE); - memset((char *) &creds, 0, sizeof(creds)); + memset(&creds, 0, sizeof(creds)); if (! xdr_authgssapi_creds(&xdrs, &creds)) { PRINTF(("svcauth_gssapi: failed decoding creds\n")); LOG_MISCERR("protocol error in client credentials"); @@ -691,7 +691,7 @@ static svc_auth_gssapi_data *create_client(void) client_data = (svc_auth_gssapi_data *) malloc(sizeof(*client_data)); if (client_data == NULL) return NULL; - memset((char *) client_data, 0, sizeof(*client_data)); + memset(client_data, 0, sizeof(*client_data)); L_PRINTF(2, ("create_client: new client_data = %p\n", (void *) client_data)); diff --git a/src/lib/rpc/svc_tcp.c b/src/lib/rpc/svc_tcp.c index 595723f04..46c207adb 100644 --- a/src/lib/rpc/svc_tcp.c +++ b/src/lib/rpc/svc_tcp.c @@ -156,7 +156,7 @@ svctcp_create( set_cloexec_fd(sock); madesock = TRUE; } - memset((char *)&addr, 0, sizeof (addr)); + memset(&addr, 0, sizeof (addr)); #if HAVE_STRUCT_SOCKADDR_IN_SIN_LEN addr.sin_len = sizeof(addr); #endif diff --git a/src/lib/rpc/svc_udp.c b/src/lib/rpc/svc_udp.c index f4cbddd56..232872dd8 100644 --- a/src/lib/rpc/svc_udp.c +++ b/src/lib/rpc/svc_udp.c @@ -123,7 +123,7 @@ svcudp_bufcreate( set_cloexec_fd(sock); madesock = TRUE; } - memset((char *)&addr, 0, sizeof (addr)); + memset(&addr, 0, sizeof (addr)); #if HAVE_STRUCT_SOCKADDR_IN_SIN_LEN addr.sin_len = sizeof(addr); #endif @@ -194,7 +194,7 @@ svcudp_recv( uint32_t replylen; again: - memset((char *) &dummy, 0, sizeof(dummy)); + memset(&dummy, 0, sizeof(dummy)); dummy_iov[0].iov_base = rpc_buffer(xprt); dummy_iov[0].iov_len = (int) su->su_iosz; dummy.msg_iov = dummy_iov; @@ -337,7 +337,7 @@ svcudp_destroy(register SVCXPRT *xprt) (type *) mem_alloc((unsigned) (sizeof(type) * (size))) #define BZERO(addr, type, size) \ - memset((char *) addr, 0, sizeof(type) * (int) (size)) + memset(addr, 0, sizeof(type) * (int) (size)) /* * An entry in the cache diff --git a/src/lib/rpc/unit-test/rpc_test_clnt.c b/src/lib/rpc/unit-test/rpc_test_clnt.c index 736392551..4e4a18a72 100644 --- a/src/lib/rpc/unit-test/rpc_test_clnt.c +++ b/src/lib/rpc/unit-test/rpc_test_clnt.c @@ -11,7 +11,7 @@ rpc_test_echo_1(argp, clnt) { static char *clnt_res; - memset((char *)&clnt_res, 0, sizeof (clnt_res)); + memset(&clnt_res, 0, sizeof (clnt_res)); if (clnt_call(clnt, RPC_TEST_ECHO, (xdrproc_t) xdr_wrapstring, (caddr_t) argp, (xdrproc_t) xdr_wrapstring, (caddr_t) &clnt_res, diff --git a/src/lib/rpc/unit-test/rpc_test_svc.c b/src/lib/rpc/unit-test/rpc_test_svc.c index 4200d955c..61b51e08b 100644 --- a/src/lib/rpc/unit-test/rpc_test_svc.c +++ b/src/lib/rpc/unit-test/rpc_test_svc.c @@ -53,7 +53,7 @@ rpc_test_prog_1_svc(rqstp, transp) _rpcsvcstate = _SERVED; return; } - (void) memset((char *)&argument, 0, sizeof (argument)); + (void) memset(&argument, 0, sizeof (argument)); if (!svc_getargs(transp, xdr_argument, &argument)) { svcerr_decode(transp); _rpcsvccount--; diff --git a/src/plugins/kdb/db2/kdb_db2.c b/src/plugins/kdb/db2/kdb_db2.c index 85828095c..a947f2b03 100644 --- a/src/plugins/kdb/db2/kdb_db2.c +++ b/src/plugins/kdb/db2/kdb_db2.c @@ -180,7 +180,7 @@ k5db2_clear_context(krb5_db2_context *dbctx) /* * Clear the structure and reset the defaults. */ - memset((char *) dbctx, 0, sizeof(krb5_db2_context)); + memset(dbctx, 0, sizeof(krb5_db2_context)); dbctx->db_name = default_db_name; dbctx->db_nb_locks = FALSE; dbctx->tempdb = FALSE; @@ -199,7 +199,7 @@ k5db2_init_context(krb5_context context) if (db_ctx == NULL) return ENOMEM; else { - memset((char *) db_ctx, 0, sizeof(krb5_db2_context)); + memset(db_ctx, 0, sizeof(krb5_db2_context)); k5db2_clear_context((krb5_db2_context *) db_ctx); dal_handle->db_context = (void *) db_ctx; } @@ -1113,7 +1113,7 @@ krb5_db2_db_delete_principal(krb5_context context, case 0: ; } - memset((char *) &entry, 0, sizeof(entry)); + memset(&entry, 0, sizeof(entry)); contdata.data = contents.data; contdata.length = contents.size; retval = krb5_decode_princ_contents(context, &contdata, &entry); @@ -1124,7 +1124,7 @@ krb5_db2_db_delete_principal(krb5_context context, /* Clear encrypted key contents */ for (i = 0; i < entry.n_key_data; i++) { if (entry.key_data[i].key_data_length[0]) { - memset((char *) entry.key_data[i].key_data_contents[0], 0, + memset(entry.key_data[i].key_data_contents[0], 0, (unsigned) entry.key_data[i].key_data_length[0]); } } diff --git a/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c b/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c index 08a87fe8e..4b8fcb2b5 100644 --- a/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c +++ b/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c @@ -121,8 +121,8 @@ krb5_ldap_read_startup_information(krb5_context context) || ((mask & LDAP_REALM_KRBTICKETFLAGS) == 0)) { kadm5_config_params params_in, params_out; - memset((char *) ¶ms_in, 0, sizeof(params_in)); - memset((char *) ¶ms_out, 0, sizeof(params_out)); + memset(¶ms_in, 0, sizeof(params_in)); + memset(¶ms_out, 0, sizeof(params_out)); retval = kadm5_get_config_params(context, 1, ¶ms_in, ¶ms_out); if (retval) { diff --git a/src/plugins/kdb/ldap/libkdb_ldap/ldap_krbcontainer.c b/src/plugins/kdb/ldap/libkdb_ldap/ldap_krbcontainer.c index 6a9c6b6e2..5b9fa5ce6 100644 --- a/src/plugins/kdb/ldap/libkdb_ldap/ldap_krbcontainer.c +++ b/src/plugins/kdb/ldap/libkdb_ldap/ldap_krbcontainer.c @@ -86,7 +86,7 @@ krb5_ldap_read_krbcontainer_params(krb5_context context, cparams =(krb5_ldap_krbcontainer_params *) malloc(sizeof(krb5_ldap_krbcontainer_params)); CHECK_NULL(cparams); - memset((char *) cparams, 0, sizeof(krb5_ldap_krbcontainer_params)); + memset(cparams, 0, sizeof(krb5_ldap_krbcontainer_params)); /* read kerberos containter location from [dbmodules] section of krb5.conf file */ if (ldap_context->conf_section) { diff --git a/src/plugins/kdb/ldap/libkdb_ldap/ldap_realm.c b/src/plugins/kdb/ldap/libkdb_ldap/ldap_realm.c index d41ffa329..e02a51a4a 100644 --- a/src/plugins/kdb/ldap/libkdb_ldap/ldap_realm.c +++ b/src/plugins/kdb/ldap/libkdb_ldap/ldap_realm.c @@ -1224,7 +1224,7 @@ krb5_ldap_read_realm_params(context, lrealm, rlparamp, mask) /* Initialize realm container structure */ rlparams =(krb5_ldap_realm_params *) malloc(sizeof(krb5_ldap_realm_params)); CHECK_NULL(rlparams); - memset((char *) rlparams, 0, sizeof(krb5_ldap_realm_params)); + memset(rlparams, 0, sizeof(krb5_ldap_realm_params)); /* allocate tl_data structure to store MASK information */ rlparams->tl_data = malloc (sizeof(krb5_tl_data)); @@ -1232,7 +1232,7 @@ krb5_ldap_read_realm_params(context, lrealm, rlparamp, mask) st = ENOMEM; goto cleanup; } - memset((char *) rlparams->tl_data, 0, sizeof(krb5_tl_data)); + memset(rlparams->tl_data, 0, sizeof(krb5_tl_data)); rlparams->tl_data->tl_data_type = KDB_TL_USER_INFO; /* set the mask parameter to 0 */ diff --git a/src/plugins/kdb/ldap/libkdb_ldap/ldap_service_stash.c b/src/plugins/kdb/ldap/libkdb_ldap/ldap_service_stash.c index 3c2fbacca..b799756a0 100644 --- a/src/plugins/kdb/ldap/libkdb_ldap/ldap_service_stash.c +++ b/src/plugins/kdb/ldap/libkdb_ldap/ldap_service_stash.c @@ -132,7 +132,7 @@ krb5_ldap_readpassword(context, ldap_context, password) st = ENOMEM; goto rp_exit; } - memcpy((char *)(*password), start, len); + memcpy(*password, start, len); (*password)[len] = '\0'; (*password)[len + 1] = '\0'; goto got_password; diff --git a/src/slave/kprop.c b/src/slave/kprop.c index 5f68f29e8..0c2709ae9 100644 --- a/src/slave/kprop.c +++ b/src/slave/kprop.c @@ -262,7 +262,7 @@ void get_tickets(context) * * Construct the principal name for the slave host. */ - memset((char *)&creds, 0, sizeof(creds)); + memset(&creds, 0, sizeof(creds)); retval = krb5_sname_to_principal(context, slave_host, KPROP_SERVICE_NAME, KRB5_NT_SRV_HST, &creds.server); @@ -342,7 +342,7 @@ open_connection(host, fd, Errmsg, ErrmsgSz) return(0); } my_sin.sin_family = hp->h_addrtype; - memcpy((char *)&my_sin.sin_addr, hp->h_addr, sizeof(my_sin.sin_addr)); + memcpy(&my_sin.sin_addr, hp->h_addr, sizeof(my_sin.sin_addr)); if(!port) { sp = getservbyname(KPROP_SERVICE, "tcp"); if (sp == 0) { @@ -372,7 +372,7 @@ open_connection(host, fd, Errmsg, ErrmsgSz) receiver_addr.addrtype = ADDRTYPE_INET; receiver_addr.length = sizeof(my_sin.sin_addr); receiver_addr.contents = (krb5_octet *) malloc(sizeof(my_sin.sin_addr)); - memcpy((char *) receiver_addr.contents, (char *) &my_sin.sin_addr, + memcpy(receiver_addr.contents, &my_sin.sin_addr, sizeof(my_sin.sin_addr)); socket_length = sizeof(my_sin); @@ -385,7 +385,7 @@ open_connection(host, fd, Errmsg, ErrmsgSz) sender_addr.addrtype = ADDRTYPE_INET; sender_addr.length = sizeof(my_sin.sin_addr); sender_addr.contents = (krb5_octet *) malloc(sizeof(my_sin.sin_addr)); - memcpy((char *) sender_addr.contents, (char *) &my_sin.sin_addr, + memcpy(sender_addr.contents, &my_sin.sin_addr, sizeof(my_sin.sin_addr)); return(0); @@ -672,7 +672,7 @@ xmit_database(context, auth_context, my_creds, fd, database_fd, exit(1); } - memcpy((char *)&send_size, outbuf.data, sizeof(send_size)); + memcpy(&send_size, outbuf.data, sizeof(send_size)); send_size = ntohl(send_size); if (send_size != database_size) { com_err(progname, 0, @@ -696,7 +696,7 @@ send_error(context, my_creds, fd, err_text, err_code) const char *text; krb5_data outbuf; - memset((char *)&error, 0, sizeof(error)); + memset(&error, 0, sizeof(error)); krb5_us_timeofday(context, &error.ctime, &error.cusec); error.server = my_creds->server; error.client = my_principal; diff --git a/src/slave/kpropd.c b/src/slave/kpropd.c index ba63d5847..cf4715ee2 100644 --- a/src/slave/kpropd.c +++ b/src/slave/kpropd.c @@ -276,7 +276,7 @@ retry: com_err(progname, errno, "while obtaining socket"); exit(1); } - memset((char *) &my_sin,0, sizeof(my_sin)); + memset(&my_sin,0, sizeof(my_sin)); if(!port) { sp = getservbyname(KPROP_SERVICE, "tcp"); if (sp == NULL) { @@ -361,7 +361,7 @@ retry: int child_pid; int status; - memset((char *)&frominet, 0, sizeof(frominet)); + memset(&frominet, 0, sizeof(frominet)); fromlen = sizeof(frominet); if (debug) fprintf(stderr, "waiting for a kprop connection\n"); @@ -1019,7 +1019,7 @@ void PRS(argv) static const char tmp[] = ".temp"; kdb_log_context *log_ctx; - (void) memset((char *)¶ms, 0, sizeof (params)); + (void) memset(¶ms, 0, sizeof (params)); retval = krb5_init_context(&kpropd_context); if (retval) { @@ -1221,7 +1221,7 @@ kerberos_authenticate(context, fd, clientp, etype, my_sin) sender_addr.addrtype = ADDRTYPE_INET; sender_addr.length = sizeof(my_sin.sin_addr); sender_addr.contents = (krb5_octet *) malloc(sizeof(my_sin.sin_addr)); - memcpy((char *) sender_addr.contents, (char *) &my_sin.sin_addr, + memcpy(sender_addr.contents, &my_sin.sin_addr, sizeof(my_sin.sin_addr)); sin_length = sizeof(r_sin); @@ -1233,7 +1233,7 @@ kerberos_authenticate(context, fd, clientp, etype, my_sin) receiver_addr.addrtype = ADDRTYPE_INET; receiver_addr.length = sizeof(r_sin.sin_addr); receiver_addr.contents = (krb5_octet *) malloc(sizeof(r_sin.sin_addr)); - memcpy((char *) receiver_addr.contents, (char *) &r_sin.sin_addr, + memcpy(receiver_addr.contents, &r_sin.sin_addr, sizeof(r_sin.sin_addr)); if (debug) { @@ -1410,7 +1410,7 @@ recv_database(context, fd, database_fd, confmsg) "while decoding database size from client"); exit(1); } - memcpy((char *) &database_size, outbuf.data, sizeof(database_size)); + memcpy(&database_size, outbuf.data, sizeof(database_size)); krb5_free_data_contents(context, &inbuf); krb5_free_data_contents(context, &outbuf); database_size = ntohl(database_size); @@ -1508,7 +1508,7 @@ send_error(context, fd, err_code, err_text) krb5_data outbuf; char buf[1024]; - memset((char *)&error, 0, sizeof(error)); + memset(&error, 0, sizeof(error)); krb5_us_timeofday(context, &error.stime, &error.susec); error.server = server; error.client = client; diff --git a/src/slave/kpropd_rpc.c b/src/slave/kpropd_rpc.c index e5713b2e1..cd9539533 100644 --- a/src/slave/kpropd_rpc.c +++ b/src/slave/kpropd_rpc.c @@ -14,7 +14,7 @@ iprop_null_1(void *argp, CLIENT *clnt) { static char clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call (clnt, IPROP_NULL, (xdrproc_t) xdr_void, (caddr_t) argp, (xdrproc_t) xdr_void, (caddr_t) &clnt_res, @@ -29,7 +29,7 @@ iprop_get_updates_1(kdb_last_t *argp, CLIENT *clnt) { static kdb_incr_result_t clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call (clnt, IPROP_GET_UPDATES, (xdrproc_t) xdr_kdb_last_t, (caddr_t) argp, (xdrproc_t) xdr_kdb_incr_result_t, (caddr_t) &clnt_res, @@ -44,7 +44,7 @@ iprop_full_resync_1(void *argp, CLIENT *clnt) { static kdb_fullresync_result_t clnt_res; - memset((char *)&clnt_res, 0, sizeof(clnt_res)); + memset(&clnt_res, 0, sizeof(clnt_res)); if (clnt_call (clnt, IPROP_FULL_RESYNC, (xdrproc_t) xdr_void, (caddr_t) argp, (xdrproc_t) xdr_kdb_fullresync_result_t, (caddr_t) &clnt_res, diff --git a/src/slave/kproplog.c b/src/slave/kproplog.c index 7bf9bbaa3..43a7738d4 100644 --- a/src/slave/kproplog.c +++ b/src/slave/kproplog.c @@ -397,7 +397,7 @@ print_update(kdb_hlog_t *ulog, uint32_t entry, unsigned int verbose) exit(1); } - (void) memset((char *)&upd, 0, sizeof (kdb_incr_update_t)); + (void) memset(&upd, 0, sizeof (kdb_incr_update_t)); xdrmem_create(&xdrs, (char *)indx_log->entry_data, indx_log->kdb_entry_size, XDR_DECODE); if (!xdr_kdb_incr_update_t(&xdrs, &upd)) { @@ -498,7 +498,7 @@ main(int argc, char **argv) exit(1); } - (void) memset((char *)¶ms, 0, sizeof (params)); + (void) memset(¶ms, 0, sizeof (params)); if (kadm5_get_config_params(context, 1, ¶ms, ¶ms)) { (void) fprintf(stderr, diff --git a/src/tests/create/kdb5_mkdums.c b/src/tests/create/kdb5_mkdums.c index 12f4587b8..8e3eae637 100644 --- a/src/tests/create/kdb5_mkdums.c +++ b/src/tests/create/kdb5_mkdums.c @@ -195,7 +195,7 @@ main(argc, argv) } retval = krb5_db_fini(test_context); - memset((char *)master_keyblock.contents, 0, + memset(master_keyblock.contents, 0, (size_t) master_keyblock.length); if (retval && retval != KRB5_KDB_DBNOTINITED) { com_err(progname, retval, "while closing database"); @@ -218,7 +218,7 @@ add_princ(context, str_newprinc) krb5_db_entry newentry; char princ_name[4096]; - memset((char *)&newentry, 0, sizeof(newentry)); + memset(&newentry, 0, sizeof(newentry)); snprintf(princ_name, sizeof(princ_name), "%s@%s", str_newprinc, cur_realm); if ((retval = krb5_parse_name(context, princ_name, &newprinc))) { com_err(progname, retval, "while parsing '%s'", princ_name); diff --git a/src/tests/gss-threads/gss-client.c b/src/tests/gss-threads/gss-client.c index 08bac92ca..1057c05c4 100644 --- a/src/tests/gss-threads/gss-client.c +++ b/src/tests/gss-threads/gss-client.c @@ -112,7 +112,7 @@ static int get_server_info(host, port) } saddr.sin_family = hp->h_addrtype; - memcpy((char *)&saddr.sin_addr, hp->h_addr, sizeof(saddr.sin_addr)); + memcpy(&saddr.sin_addr, hp->h_addr, sizeof(saddr.sin_addr)); saddr.sin_port = htons(port); return 0; } diff --git a/src/tests/hammer/kdc5_hammer.c b/src/tests/hammer/kdc5_hammer.c index b1f5c179d..d5bab36b4 100644 --- a/src/tests/hammer/kdc5_hammer.c +++ b/src/tests/hammer/kdc5_hammer.c @@ -340,7 +340,7 @@ int verify_cs_pair(context, p_client_str, p_client, service, hostname, service); /* Initialize variables */ - memset((char *)&creds, 0, sizeof(creds)); + memset(&creds, 0, sizeof(creds)); /* Do client side */ if (asprintf(&sname, "%s@%s", service, hostname) >= 0) { @@ -466,7 +466,7 @@ int get_tgt (context, p_client_str, p_client, ccache) return(-1); } - memset((char *)&my_creds, 0, sizeof(my_creds)); + memset(&my_creds, 0, sizeof(my_creds)); if ((code = krb5_parse_name (context, p_client_str, p_client))) { com_err (prog, code, "when parsing name %s", p_client_str); diff --git a/src/tests/misc/test_getsockname.c b/src/tests/misc/test_getsockname.c index 7c85e7476..5f59da468 100644 --- a/src/tests/misc/test_getsockname.c +++ b/src/tests/misc/test_getsockname.c @@ -46,9 +46,9 @@ main(argc, argv) } /* Set server's address */ - (void) memset((char *)&s_sock, 0, sizeof(s_sock)); + (void) memset(&s_sock, 0, sizeof(s_sock)); - memcpy((char *)&s_sock.sin_addr, host->h_addr, sizeof(s_sock.sin_addr)); + memcpy(&s_sock.sin_addr, host->h_addr, sizeof(s_sock.sin_addr)); #ifdef DEBUG printf("s_sock.sin_addr is %s\n", inet_ntoa(s_sock.sin_addr)); #endif @@ -61,7 +61,7 @@ main(argc, argv) exit(1); } - memset((char *)&c_sock, 0, sizeof(c_sock)); + memset(&c_sock, 0, sizeof(c_sock)); c_sock.sin_family = AF_INET; /* Bind it to set the address; kernel will fill in port # */ @@ -78,7 +78,7 @@ main(argc, argv) } /* Get my address */ - memset((char *) &c_sock, 0, sizeof(c_sock)); + memset(&c_sock, 0, sizeof(c_sock)); i = sizeof(c_sock); if (getsockname(sock, (struct sockaddr *)&c_sock, &i) < 0) { perror("getsockname"); diff --git a/src/tests/verify/kdb5_verify.c b/src/tests/verify/kdb5_verify.c index be8b4ae5a..01ba3e32f 100644 --- a/src/tests/verify/kdb5_verify.c +++ b/src/tests/verify/kdb5_verify.c @@ -209,7 +209,7 @@ main(argc, argv) krb5_finish_key(context, &master_encblock); retval = krb5_db_fini(context); - memset((char *)master_keyblock.contents, 0, (size_t) master_keyblock.length); + memset(master_keyblock.contents, 0, (size_t) master_keyblock.length); if (retval && retval != KRB5_KDB_DBNOTINITED) { com_err(progname, retval, "while closing database"); exit(1); -- 2.26.2