lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 28 Oct 2016 10:35:34 +0200
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     linux-kbuild@...r.kernel.org, Michal Marek <mmarek@...e.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH 05/10] scripts/basic/fixdep: Complete error handling in
 parse_dep_file()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Thu, 27 Oct 2016 19:43:43 +0200

Return values were not checked from five calls of the function "printf".

This issue was detected also by using the Coccinelle software.


* Add a bit of exception handling there.

* Combine these calls into three.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 scripts/basic/fixdep.c | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 9a2ff68..5f6a4f4 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -366,14 +366,25 @@ static void parse_dep_file(void *map, size_t len)
 					 */
 					if (!saw_any_target) {
 						saw_any_target = 1;
-						printf("source_%s := %s\n\n",
-							target, s);
-						printf("deps_%s := \\\n",
-							target);
+						if (printf("source_%s := %s\n\n"
+							   "deps_%s := \\\n",
+							   target, s, target)
+						   < 24) {
+							int code = errno;
+
+							perror("fixdep: printf");
+							exit(code);
+						}
 					}
 					is_first_dep = 0;
-				} else
-					printf("  %s \\\n", s);
+				} else {
+					if (printf("  %s \\\n", s) < 5) {
+						int code = errno;
+
+						perror("fixdep: printf");
+						exit(code);
+					}
+				}
 				do_config_file(s);
 			}
 		}
@@ -391,8 +402,13 @@ static void parse_dep_file(void *map, size_t len)
 
 	do_extra_deps();
 
-	printf("\n%s: $(deps_%s)\n\n", target, target);
-	printf("$(deps_%s):\n", target);
+	if (printf("\n%s: $(deps_%s)\n\n"
+		   "$(deps_%s):\n", target, target, target) < 27) {
+		int code = errno;
+
+		perror("fixdep: printf");
+		exit(code);
+	}
 }
 
 static void print_deps(void)
-- 
2.10.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ