From 46f401ef80a4bede99ed5034d03836f6e7ca6936 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Thu, 24 Apr 2014 20:34:06 -0400 Subject: [PATCH] Quash various warnings from higher levels of compiler warnings. Two changes are to avoid never-true checks that a local array is not a null pointer; two changes are to the length arguments of memset/memcpy. (The MD5 change is just for cleaning up; the parser change should only affect systems where sizeof(long) != sizeof(struct ListenerFlags*), but that is not true of any system that is likely to run ircu2.) --- ircd/crule.c | 2 +- ircd/ircd_md5.c | 2 +- ircd/ircd_parser.y | 2 +- ircd/m_pass.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ircd/crule.c b/ircd/crule.c index 1a1fd21..a91aecb 100644 --- a/ircd/crule.c +++ b/ircd/crule.c @@ -737,7 +737,7 @@ static int crule_parsearglist(CRuleNodePtr argrootp, int *next_tokp, const char* #if !defined(CR_DEBUG) && !defined(CR_CHKCONF) collapse(currarg); #endif - if (!BadPtr(currarg)) + if (currarg[0] != '\0') { DupString(argelemp, currarg); argrootp->arg[argrootp->numargs++] = (void *)argelemp; diff --git a/ircd/ircd_md5.c b/ircd/ircd_md5.c index fd14a34..0d7d73e 100644 --- a/ircd/ircd_md5.c +++ b/ircd/ircd_md5.c @@ -154,7 +154,7 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx) MD5Transform(ctx->buf, (uint32 *) ctx->in); byteReverse((unsigned char *) ctx->buf, 4); memcpy(digest, ctx->buf, 16); - memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ + memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ } #ifndef ASM_MD5 diff --git a/ircd/ircd_parser.y b/ircd/ircd_parser.y index a43b944..64a112c 100644 --- a/ircd/ircd_parser.y +++ b/ircd/ircd_parser.y @@ -709,7 +709,7 @@ portblock: PORT '{' portitems '}' ';' { hosts = link; } for (link = hosts; link != NULL; link = link->next) { - memcpy(&flags_here, &listen_flags, sizeof(&flags_here)); + memcpy(&flags_here, &listen_flags, sizeof(flags_here)); switch (link->flags & (USE_IPV4 | USE_IPV6)) { case USE_IPV4: FlagSet(&flags_here, LISTEN_IPV4); diff --git a/ircd/m_pass.c b/ircd/m_pass.c index eb08e9f..e34e681 100644 --- a/ircd/m_pass.c +++ b/ircd/m_pass.c @@ -116,7 +116,7 @@ int mr_pass(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) --len; password[len] = '\0'; - if (EmptyString(password)) + if (password[0] == '\0') return need_more_params(cptr, "PASS"); ircd_strncpy(cli_passwd(cptr), password, PASSWDLEN); -- 2.20.1