From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from blyat.fensystems.co.uk (blyat.fensystems.co.uk [54.246.183.96]) by mx.groups.io with SMTP id smtpd.web11.430.1664211913218101796 for ; Mon, 26 Sep 2022 10:05:13 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: ipxe.org, ip: 54.246.183.96, mailfrom: mcb30@ipxe.org) Received: from [IPV6:2a00:23c6:5486:8700:eaa7:4ea6:88e4:6f0e] (unknown [IPv6:2a00:23c6:5486:8700:eaa7:4ea6:88e4:6f0e]) by blyat.fensystems.co.uk (Postfix) with ESMTPSA id C3251443CA; Mon, 26 Sep 2022 16:27:24 +0000 (UTC) Message-ID: Date: Mon, 26 Sep 2022 17:27:24 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [edk2-devel] [PATCH] NetworkPkg: Add WiFi profile sync protocol support To: devel@edk2.groups.io, zachary.clark-williams@intel.com, "Luo, Heng" Cc: Zachary Clark-Williams , Maciej Rabeda References: From: "Michael Brown" In-Reply-To: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on blyat.fensystems.co.uk Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 26/09/2022 16:39, Clark-williams, Zachary wrote: >>> + if (Profile->Password[StrLen (Profile->Password)] != '\0') { >>> + Profile->Password[StrLen (Profile->Password)] = L'\0'; } >>> + >> I don't understand this change, StrLen returns the length of a Null-terminated Unicode string, it means "Profile->Password[StrLen (Profile->Password)]" should always be 0. Did you see exceptional case? > Yes this is checking if the users entered password had a terminator on the end, if it doesn't we are adding it. > During dev and testing we found a failure case if this was not tested and fixed. No. StrLen() works by scanning the string until it finds a L'\0' terminator. Your code is provably wrong. I would suggest that you retest, and find the mistake in your testing process. Michael