Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Dec 2011 13:32:59 -0800
From:      mdf@FreeBSD.org
To:        Dimitry Andric <dim@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r228625 - head/usr.bin/csup
Message-ID:  <CAMBSHm9cBbCxZ9MvgPvKgYfSxPSpeofgTq0NnJo=e3tR5idxEQ@mail.gmail.com>
In-Reply-To: <201112171314.pBHDEjtQ060509@svn.freebsd.org>
References:  <201112171314.pBHDEjtQ060509@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Dec 17, 2011 at 5:14 AM, Dimitry Andric <dim@freebsd.org> wrote:
> Author: dim
> Date: Sat Dec 17 13:14:44 2011
> New Revision: 228625
> URL: http://svn.freebsd.org/changeset/base/228625
>
> Log:
> =A0In usr.bin/csup/auth.c, use the correct number of bytes for zeroing th=
e
> =A0shared secret, and use long long format to snprintf a time_t.

If casting is necessary, style prefers intmax_t or uintmax_t, since
those are always wide enough.

Thanks,
matthew

> =A0MFC after: =A0 =A01 week
>
> Modified:
> =A0head/usr.bin/csup/auth.c
>
> Modified: head/usr.bin/csup/auth.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/usr.bin/csup/auth.c =A0 =A0Sat Dec 17 12:52:58 2011 =A0 =A0 =A0 =
=A0(r228624)
> +++ head/usr.bin/csup/auth.c =A0 =A0Sat Dec 17 13:14:44 2011 =A0 =A0 =A0 =
=A0(r228625)
> @@ -254,7 +254,7 @@ auth_makesecret(struct srvrecord *auth,
> =A0 =A0 =A0 =A0MD5_Update(&md5, ":", 1);
> =A0 =A0 =A0 =A0MD5_Update(&md5, auth->password, strlen(auth->password));
> =A0 =A0 =A0 =A0MD5_Final(md5sum, &md5);
> - =A0 =A0 =A0 memset(secret, 0, sizeof(secret));
> + =A0 =A0 =A0 memset(secret, 0, MD5_CHARS_MAX);
> =A0 =A0 =A0 =A0strcpy(secret, md5salt);
> =A0 =A0 =A0 =A0auth_readablesum(md5sum, secret + strlen(md5salt));
> =A0}
> @@ -302,8 +302,9 @@ auth_makechallenge(struct config *config
> =A0 =A0 =A0 =A0}
> =A0 =A0 =A0 =A0gettimeofday(&tv, NULL);
> =A0 =A0 =A0 =A0MD5_Init(&md5);
> - =A0 =A0 =A0 snprintf(buf, sizeof(buf), "%s:%ld:%ld:%ld:%d:%d",
> - =A0 =A0 =A0 =A0 =A0 inet_ntoa(laddr.sin_addr), tv.tv_sec, tv.tv_usec, r=
andom(), pid, ppid);
> + =A0 =A0 =A0 snprintf(buf, sizeof(buf), "%s:%lld:%ld:%ld:%d:%d",
> + =A0 =A0 =A0 =A0 =A0 inet_ntoa(laddr.sin_addr), (long long)tv.tv_sec, tv=
.tv_usec,
> + =A0 =A0 =A0 =A0 =A0 random(), pid, ppid);
> =A0 =A0 =A0 =A0MD5_Update(&md5, buf, strlen(buf));
> =A0 =A0 =A0 =A0MD5_Final(md5sum, &md5);
> =A0 =A0 =A0 =A0auth_readablesum(md5sum, challenge);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMBSHm9cBbCxZ9MvgPvKgYfSxPSpeofgTq0NnJo=e3tR5idxEQ>