[PATCH] Fix crash when GIT_DIR is invalid

Subsystems: the rest

DORMANTno replies

3 messages, 2 authors, 2016-06-15 · open the first message on its own page

[PATCH] Fix crash when GIT_DIR is invalid

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:42:35

We used to test if a pointer was NULL, and if it was, try to access it.

Signed-off-by: Johannes Schindelin <redacted>
---
 setup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/setup.c b/setup.c
index 358e139..2afdba4 100644
--- a/setup.c
+++ b/setup.c
@@ -184,7 +184,7 @@ const char *setup_git_directory_gently(i
 		}
 		return NULL;
 	bad_dir_environ:
-		if (!nongit_ok) {
+		if (nongit_ok) {
 			*nongit_ok = 1;
 			return NULL;
 		}
-- 
1.4.2.rc2.g0bca-dirty

Re: [PATCH] Fix crash when GIT_DIR is invalid

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:35

Johannes Schindelin [off-list ref] writes:
 	bad_dir_environ:
-		if (!nongit_ok) {
+		if (nongit_ok) {
 			*nongit_ok = 1;
*BLUSH*  How could I have missed something like this...

Thanks.

Re: [PATCH] Fix crash when GIT_DIR is invalid

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:42:35

Hi,

On Fri, 4 Aug 2006, Junio C Hamano wrote:
Johannes Schindelin [off-list ref] writes:
quoted
 	bad_dir_environ:
-		if (!nongit_ok) {
+		if (nongit_ok) {
 			*nongit_ok = 1;
*BLUSH*  How could I have missed something like this...
It's too easy. I actually reviewed that patch, saw that I did the same 
(not!), and hit the bug...

Ciao,
Dscho "errare humanum est" --
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help