Message ID | 20190610105238.15503-1-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
Series | fwts_args: check for null text pointer | expand |
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>
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>
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",