fwts_args: check for null text pointer
diff mbox series

Message ID 20190610105238.15503-1-colin.king@canonical.com
State Accepted
Headers show
Series
  • fwts_args: check for null text pointer
Related show

Commit Message

Colin King June 10, 2019, 10:52 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The pointer text can potentially be null, so check for this.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_args.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Alex Hung June 10, 2019, 8:28 p.m. UTC | #1
On 2019-06-10 3:52 a.m., Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The pointer text can potentially be null, so check for this.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_args.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/lib/src/fwts_args.c b/src/lib/src/fwts_args.c
> index 95a2a606..ccdcac51 100644
> --- a/src/lib/src/fwts_args.c
> +++ b/src/lib/src/fwts_args.c
> @@ -274,6 +274,8 @@ static void fwts_args_show_option(
>  
>  	text = fwts_format_text(explanation,
>  		width < 0 ? (FWTS_MIN_TTY_WIDTH - FWTS_ARGS_WIDTH-1) : width);
> +	if (!text)
> +		return;
>  
>  	fwts_list_foreach(item, text) {
>  		printf("%-*.*s %s\n",
> 


Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan June 11, 2019, 5:44 a.m. UTC | #2
On 6/10/19 6:52 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The pointer text can potentially be null, so check for this.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_args.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/lib/src/fwts_args.c b/src/lib/src/fwts_args.c
> index 95a2a606..ccdcac51 100644
> --- a/src/lib/src/fwts_args.c
> +++ b/src/lib/src/fwts_args.c
> @@ -274,6 +274,8 @@ static void fwts_args_show_option(
>  
>  	text = fwts_format_text(explanation,
>  		width < 0 ? (FWTS_MIN_TTY_WIDTH - FWTS_ARGS_WIDTH-1) : width);
> +	if (!text)
> +		return;
>  
>  	fwts_list_foreach(item, text) {
>  		printf("%-*.*s %s\n",


Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch
diff mbox series

diff --git a/src/lib/src/fwts_args.c b/src/lib/src/fwts_args.c
index 95a2a606..ccdcac51 100644
--- a/src/lib/src/fwts_args.c
+++ b/src/lib/src/fwts_args.c
@@ -274,6 +274,8 @@  static void fwts_args_show_option(
 
 	text = fwts_format_text(explanation,
 		width < 0 ? (FWTS_MIN_TTY_WIDTH - FWTS_ARGS_WIDTH-1) : width);
+	if (!text)
+		return;
 
 	fwts_list_foreach(item, text) {
 		printf("%-*.*s %s\n",