lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 06 Jan 2015 09:20:37 -0800
From:	Joe Perches <joe@...ches.com>
To:	Mark Salyzyn <salyzyn@...roid.com>
Cc:	linux-kernel@...r.kernel.org, Anton Vorontsov <anton@...msg.org>,
	Colin Cross <ccross@...roid.com>,
	Kees Cook <keescook@...omium.org>,
	Tony Luck <tony.luck@...el.com>
Subject: Re: [PATCH 1/3] pstore: use snprintf

On Tue, 2015-01-06 at 09:15 -0800, Mark Salyzyn wrote:
> No guarantees that the names will not exceed the
> name buffer with future adjustments.
[]
> diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
[]
> @@ -338,32 +338,34 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,
>  
>  	switch (type) {
>  	case PSTORE_TYPE_DMESG:
> -		sprintf(name, "dmesg-%s-%lld%s", psname, id,
> +		snprintf(name, sizeof(name), "dmesg-%s-%lld%s", psname, id,
>  						compressed ? ".enc.z" : "");

scnprintf to ensure null termination?

(and maybe better written like)

		scnprintf(name, sizeof(name), "dmesg-%s-%lld%s",
			  psname, id, compressed ? ".enc.z" : "");

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ