From owner-svn-src-all@FreeBSD.ORG Sat May 9 22:54:12 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 67AE444E; Sat, 9 May 2015 22:54:12 +0000 (UTC) Received: from mail-pa0-x22b.google.com (mail-pa0-x22b.google.com [IPv6:2607:f8b0:400e:c03::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3720D1DF6; Sat, 9 May 2015 22:54:12 +0000 (UTC) Received: by pacyx8 with SMTP id yx8so79030298pac.1; Sat, 09 May 2015 15:54:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=GivVWLdvCZj1esIOpkdt/bg9AZ08pdgaoBQevxsDpfs=; b=Dc2e3C4SGi73mThrEhX67S8HCqcHyB11I9n51Istfgd9AsQiSU5yDAoU+aXNBrgOo8 892IVA2J2T4N5Fv/dlRD7S+zPeVHAWcJrjhEHF4JDtBrYLKBUjyIY+HzkKHCtwuhf5z+ Gxw4QP4QP8Vm9Bf7tgE3KC9eYPu7YcgIv7FEBsTWE49NZ6UCrhZNbtYZ4dfUWqXFoiNv n+bMbgfVpjgqbnMD5qXzo2p1oz0Mo0bnGCiog5j6rX7nbf9Y8MG/w8C5H+595tGN7+mn EMdpc71d813r22MboPUd/EeOwCmcm8TkdMo2w+V0g2zMLDE45jAyDy8ct2Vfy827nSqz kqiA== X-Received: by 10.68.94.129 with SMTP id dc1mr7554061pbb.8.1431212051104; Sat, 09 May 2015 15:54:11 -0700 (PDT) Received: from [192.168.20.11] (c-98-247-240-204.hsd1.wa.comcast.net. [98.247.240.204]) by mx.google.com with ESMTPSA id nb10sm8891284pdb.76.2015.05.09.15.54.10 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 09 May 2015 15:54:10 -0700 (PDT) References: <201505091912.t49JCHRf067749@svn.freebsd.org> Mime-Version: 1.0 (1.0) In-Reply-To: <201505091912.t49JCHRf067749@svn.freebsd.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <4DE758E7-BE6B-45D6-A184-9443FB21F4A7@gmail.com> Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Mailer: iPhone Mail (12F70) From: Garrett Cooper Subject: Re: svn commit: r282685 - head/usr.sbin/pw Date: Sat, 9 May 2015 15:54:09 -0700 To: Baptiste Daroussin X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 May 2015 22:54:12 -0000 > On May 9, 2015, at 12:12, Baptiste Daroussin wrote: >=20 > Author: bapt > Date: Sat May 9 19:12:16 2015 > New Revision: 282685 > URL: https://svnweb.freebsd.org/changeset/base/282685 >=20 > Log: > Replace malloc(3) + strcpy(3) + strcat(3) by asprintf(3) >=20 > Modified: > head/usr.sbin/pw/pw_user.c >=20 > Modified: head/usr.sbin/pw/pw_user.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.sbin/pw/pw_user.c Sat May 9 19:11:01 2015 (r282684) > +++ head/usr.sbin/pw/pw_user.c Sat May 9 19:12:16 2015 (r282685) > @@ -363,11 +363,9 @@ pw_user(struct userconf * cnf, int mode, > if (mode =3D=3D M_LOCK) { > if (strncmp(pwd->pw_passwd, locked_str, sizeof(locked_str)-1) =3D= =3D 0) > errx(EX_DATAERR, "user '%s' is already locked", pwd->pw_nam= e); > - passtmp =3D malloc(strlen(pwd->pw_passwd) + sizeof(locked_str= )); > + asprintf(&passtmp, "%s%s", locked_str, pwd->pw_passwd); > if (passtmp =3D=3D NULL) /* disaster */ > errx(EX_UNAVAILABLE, "out of memory"); > - strcpy(passtmp, locked_str); > - strcat(passtmp, pwd->pw_passwd); > pwd->pw_passwd =3D passtmp; > edited =3D 1; > } else if (mode =3D=3D M_UNLOCK) { Please check the return values from asprintf..=