ACK: [PATCH] fwts_modprobe: fix potential null pointer dereference
Alex Hung
alex.hung at canonical.com
Mon Jun 10 20:28:24 UTC 2019
On 2019-06-10 3:17 a.m., Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> The null pointer check is currently incorrect; if ptr is null then
> we currently have a null pointer dereference. The check should be
> for a null ptr rather rather than the contents of the object being
> pointed to being non-zero.
>
> Addresses-Coverity: ("Dereference null pointer")
> Fixes: cbf322756c13 ("src/lib: add module probing helper functions")
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/lib/src/fwts_modprobe.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/lib/src/fwts_modprobe.c b/src/lib/src/fwts_modprobe.c
> index 05871f2c..a05a581f 100644
> --- a/src/lib/src/fwts_modprobe.c
> +++ b/src/lib/src/fwts_modprobe.c
> @@ -131,7 +131,7 @@ int fwts_module_loaded(fwts_framework *fw, const char *module, bool *loaded)
> while (fgets(buffer, sizeof(buffer) - 1, fp) != NULL) {
> char *ptr = strchr(buffer, ' ');
>
> - if (*ptr)
> + if (ptr)
> *ptr = '\0';
>
> if (!strcmp(buffer, module)) {
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list