diff mbox

[1/3] uefibootpath: fix the URI length check

Message ID 1475137643-28064-1-git-send-email-ivan.hu@canonical.com
State Accepted
Headers show

Commit Message

Ivan Hu Sept. 29, 2016, 8:27 a.m. UTC
From UEFI spec, the URI could be empty, fixing the length check.

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/uefi/uefibootpath/uefibootpath.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Colin Ian King Sept. 29, 2016, 8:56 a.m. UTC | #1
On 29/09/16 09:27, Ivan Hu wrote:
> From UEFI spec, the URI could be empty, fixing the length check.
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/uefi/uefibootpath/uefibootpath.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/uefi/uefibootpath/uefibootpath.c b/src/uefi/uefibootpath/uefibootpath.c
> index 2ab3b21..48a57c8 100644
> --- a/src/uefi/uefibootpath/uefibootpath.c
> +++ b/src/uefi/uefibootpath/uefibootpath.c
> @@ -546,10 +546,10 @@ static int uefibootpath_check_dev_path(fwts_framework *fw, fwts_uefi_dev_path *d
>  			}
>  			break;
>  		case FWTS_UEFI_URI_DEVICE_PATH_SUBTYPE:
> -			if (len <= sizeof(fwts_uefi_uri_dev_path)) {
> +			if (len < sizeof(fwts_uefi_uri_dev_path)) {
>  				fwts_failed(fw, LOG_LEVEL_MEDIUM, "UEFIURIDevPathLength",
>  					"The length of URI Device Path is %" PRIu16 " bytes "
> -					"should be larger than UEFI specification defined %" PRIu16 " bytes.",
> +					"should not be smaller than UEFI specification defined %" PRIu16 " bytes.",
>  					len,
>  					(uint16_t)sizeof(fwts_uefi_uri_dev_path));
>  				errors++;
> 
Acked-by: Colin Ian King <colin.king@canonical.com>
Alex Hung Sept. 29, 2016, 11:35 p.m. UTC | #2
On 2016-09-29 01:27 AM, Ivan Hu wrote:
> From UEFI spec, the URI could be empty, fixing the length check.
>
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/uefi/uefibootpath/uefibootpath.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/uefi/uefibootpath/uefibootpath.c b/src/uefi/uefibootpath/uefibootpath.c
> index 2ab3b21..48a57c8 100644
> --- a/src/uefi/uefibootpath/uefibootpath.c
> +++ b/src/uefi/uefibootpath/uefibootpath.c
> @@ -546,10 +546,10 @@ static int uefibootpath_check_dev_path(fwts_framework *fw, fwts_uefi_dev_path *d
>  			}
>  			break;
>  		case FWTS_UEFI_URI_DEVICE_PATH_SUBTYPE:
> -			if (len <= sizeof(fwts_uefi_uri_dev_path)) {
> +			if (len < sizeof(fwts_uefi_uri_dev_path)) {
>  				fwts_failed(fw, LOG_LEVEL_MEDIUM, "UEFIURIDevPathLength",
>  					"The length of URI Device Path is %" PRIu16 " bytes "
> -					"should be larger than UEFI specification defined %" PRIu16 " bytes.",
> +					"should not be smaller than UEFI specification defined %" PRIu16 " bytes.",
>  					len,
>  					(uint16_t)sizeof(fwts_uefi_uri_dev_path));
>  				errors++;
>

Acked-by: Alex Hung <alex.hung@canonical.com>
diff mbox

Patch

diff --git a/src/uefi/uefibootpath/uefibootpath.c b/src/uefi/uefibootpath/uefibootpath.c
index 2ab3b21..48a57c8 100644
--- a/src/uefi/uefibootpath/uefibootpath.c
+++ b/src/uefi/uefibootpath/uefibootpath.c
@@ -546,10 +546,10 @@  static int uefibootpath_check_dev_path(fwts_framework *fw, fwts_uefi_dev_path *d
 			}
 			break;
 		case FWTS_UEFI_URI_DEVICE_PATH_SUBTYPE:
-			if (len <= sizeof(fwts_uefi_uri_dev_path)) {
+			if (len < sizeof(fwts_uefi_uri_dev_path)) {
 				fwts_failed(fw, LOG_LEVEL_MEDIUM, "UEFIURIDevPathLength",
 					"The length of URI Device Path is %" PRIu16 " bytes "
-					"should be larger than UEFI specification defined %" PRIu16 " bytes.",
+					"should not be smaller than UEFI specification defined %" PRIu16 " bytes.",
 					len,
 					(uint16_t)sizeof(fwts_uefi_uri_dev_path));
 				errors++;