Skip to contentSkip to conversation

fix buffer overflow

PATCH In review Matthias Koenig 2 participants 2 messages Nov 21, 2007 Kernel automounter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix buffer overflow

A overflow problem due to wrong size specification in read/write calls is fixed.

---

 daemon/automount.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
daemon/automount.c +3 -3
index 7becad5..f31ec11 100644
@@ -1125,7 +1125,7 @@ static void become_daemon(unsigned foreground)
 		if (pid > 0) {
 			int r;
 			close(start_pipefd[1]);
-			r = read(start_pipefd[0], pst_stat, sizeof(pst_stat));
+			r = read(start_pipefd[0], pst_stat, sizeof(*pst_stat));
 			if (r < 0)
 				exit(1);
 			exit(*pst_stat);
@@ -2061,12 +2061,12 @@ int main(int argc, char *argv[])
 	if (!master_read_master(master_list, age, 0)) {
 		master_kill(master_list);
 		*pst_stat = 3;
-		res = write(start_pipefd[1], pst_stat, sizeof(pst_stat));
+		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
 		close(start_pipefd[1]);
 		exit(3);
 	}
 
-	res = write(start_pipefd[1], pst_stat, sizeof(pst_stat));
+	res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
 	close(start_pipefd[1]);
 
 	state_mach_thid = pthread_self();
maintainer
#1 lore raw
Quoted 2 lines · Matthias Koenig

A overflow problem due to wrong size specification in read/write calls is fixed.

What can I say, "that's really dumb of me!".

Quoted 40 lines

---

 daemon/automount.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
daemon/automount.c +3 -3
index 7becad5..f31ec11 100644
@@ -1125,7 +1125,7 @@ static void become_daemon(unsigned foreground)
 		if (pid > 0) {
 			int r;
 			close(start_pipefd[1]);
-			r = read(start_pipefd[0], pst_stat, sizeof(pst_stat));
+			r = read(start_pipefd[0], pst_stat, sizeof(*pst_stat));
 			if (r < 0)
 				exit(1);
 			exit(*pst_stat);
@@ -2061,12 +2061,12 @@ int main(int argc, char *argv[])
 	if (!master_read_master(master_list, age, 0)) {
 		master_kill(master_list);
 		*pst_stat = 3;
-		res = write(start_pipefd[1], pst_stat, sizeof(pst_stat));
+		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
 		close(start_pipefd[1]);
 		exit(3);
 	}
 
-	res = write(start_pipefd[1], pst_stat, sizeof(pst_stat));
+	res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
 	close(start_pipefd[1]);
 
 	state_mach_thid = pthread_self();

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs