[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] xen/hypfs: check the return value of snprintf to avoid leaking stack accidently
- To: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Thu, 4 Aug 2022 15:01:55 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/vzvY8rG5JYcO+qztovyVcromDl0fq1H7CGGj60lwXI=; b=fkXH5AHx30R0UyLXIF+eJSWBqw3O7/FTTf2lp01cYuNm6sWu7WMGIam9cjNRMJAwPoZocxKlazr3rF60jZMw3L6xnJCPAZ9Tjd/hxk0iKBNpEe83HDhQovCoyxRT/jajpVWtCxVXRmm6zE/07LRm7IKNBkd+1H8m4jiCU/iByzIrg6arybD/p0hLNFc28J10UoM3BOPkchfY6DHt+5IIDWtoDX+C32iatOjb0oQj5xUO/1vPQFEI4BuzmDhgxEEgPM3IWKX1CCzCW/cp0h3Zeg1UZGu3Hpf5ZiZDFyzFlMerdY7LiHEvdFcKI27fN3rmRIbvzD7RaV+yeGUou3M2Fg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IVx18/oN/CneRJ+JyafTUrdDMuNw2/USgvQSI9z73Y6DOFJ8yE3YXWUOxb1fMgMehYqv9mvEdZSZQsGGeZjL9ut3ircO3LRjtY+gzrF/Z4VH32ec5FkJHF+CsHuXMw5+eOqIKWyYeqgi9VA+y7KToS3DCUA4+Vb0mIdz259W4c1vr2MOINEXauOWl8lCxl77xTFYsAEtmDeIYo932AT0rXDB7Qzak9Ognf9sCBvDTkQhKekdVSiZtYPbfNMPwBca2zbZA1N1WXJPBfe0/IvsN/VGRuu6FID0RvjlPScE44iLzxEfpYxYAKKULHKd//aOpc5drnSE9+43mQcmL+ENyQ==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Juergen Gross <jgross@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Thu, 04 Aug 2022 13:02:05 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 04.08.2022 14:47, Xenia Ragiadakou wrote:
> Changes in v2:
> - add ASSERT_UNREACHABLE()
Hmm, this ...
> --- a/xen/common/hypfs.c
> +++ b/xen/common/hypfs.c
> @@ -377,8 +377,10 @@ int hypfs_read_dyndir_id_entry(const struct
> hypfs_entry_dir *template,
> unsigned int e_namelen, e_len;
>
> e_namelen = snprintf(name, sizeof(name), template->e.name, id);
> - if ( e_namelen >= sizeof(name) )
> + if ( e_namelen >= sizeof(name) ) {
> + ASSERT_UNREACHABLE();
> return -ENOBUFS;
> + }
... looks to be an incremental patch on top of v1, not v2 of that
patch?
Also please correct the placement of the opening brace.
Jan
|