ubiupdatevol: Prevent null pointer dereference
diff mbox series

Message ID 20190908195922.23643-1-bastiangermann@fishpost.de
State New
Delegated to: David Oberhollenzer
Headers show
Series
  • ubiupdatevol: Prevent null pointer dereference
Related show

Commit Message

Bastian Germann Sept. 8, 2019, 7:59 p.m. UTC
libubi_close(libubi) is called in the error handler if libubi is null.
Prevent that by handling the error case similar to the other ubi
executables.

Signed-off-by: Bastian Germann <bastiangermann@fishpost.de>
---
 ubi-utils/ubiupdatevol.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

David Oberhollenzer Sept. 10, 2019, 8:19 a.m. UTC | #1
Applied to mtd-utils.git master.

Thanks,

David

Patch
diff mbox series

diff --git a/ubi-utils/ubiupdatevol.c b/ubi-utils/ubiupdatevol.c
index bdcc091..1b3239e 100644
--- a/ubi-utils/ubiupdatevol.c
+++ b/ubi-utils/ubiupdatevol.c
@@ -308,9 +308,7 @@  int main(int argc, char * const argv[])
 	if (!libubi) {
 		if (errno == 0)
 			errmsg("UBI is not present in the system");
-		else
-			sys_errmsg("cannot open libubi");
-		goto out_libubi;
+		return sys_errmsg("cannot open libubi");
 	}
 
 	err = ubi_probe_node(libubi, args.node);