Skip to contentSkip to conversation

Fix Null-Pointer bug in init_ssl() when no '--ca' is set but '--capath'

PATCH In review Maximilian Wilhelm 2 participants 3 messages Oct 11, 2007 – Jan 30, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix Null-Pointer bug in init_ssl() when no '--ca' is set but '--capath'

Hi!

This little patch fixes a silly bug in init_ssl() in ssl.c where options->ca_file is accessed without prior check if it's not NULL.

The bug was introduced in revision 784.

Ciao
Max

Signature · 1 line
	Follow the white penguin.
ssl.c +1 -1
index 85e9c6f..868edc2 100644
@@ -1228,7 +1228,7 @@ init_ssl (const struct options *options)
       int status;
 
 #if ENABLE_INLINE_FILES
-      if (!strcmp (options->ca_file, INLINE_FILE_TAG) && options->ca_file_inline)
+      if (options->ca_file && !strcmp (options->ca_file, INLINE_FILE_TAG) && options->ca_file_inline)
 	{
 	  status = use_inline_load_verify_locations (ctx, options->ca_file_inline);
 	}
#1 lore raw

Am Friday, den 12 October hub Maximilian Wilhelm folgendes in die Tasten:

Hi!

What about this patch?
I think it should be included in the next -rc as it fixes a crash.

Quoted 11 lines

This little patch fixes a silly bug in init_ssl() in ssl.c where options->ca_file is accessed without prior check if it's not NULL.

The bug was introduced in revision 784.

ssl.c +0 -0
index 85e9c6f..868edc2 100644

ssl.c init_ssl (const struct options *options) · line 1234

Quoted 8 lines
ssl.c +1 -1
@@ -1228,7 +1228,7 @@ init_ssl (const struct options *options)
       int status;
 
 #if ENABLE_INLINE_FILES
-      if (!strcmp (options->ca_file, INLINE_FILE_TAG) && options->ca_file_inline)
+      if (options->ca_file && !strcmp (options->ca_file, INLINE_FILE_TAG) && options->ca_file_inline)
 	{
 	  status = use_inline_load_verify_locations (ctx, options->ca_file_inline);
 	}

Ciao
Max

Signature · 1 line
	Follow the white penguin.
#2 lore raw
Quoted 26 lines · Maximilian Wilhelm

Am Friday, den 12 October hub Maximilian Wilhelm folgendes in die Tasten:

Hi!

What about this patch?
I think it should be included in the next -rc as it fixes a crash.

Quoted 17 lines

This little patch fixes a silly bug in init_ssl() in ssl.c where options->ca_file is accessed without prior check if it's not NULL.

The bug was introduced in revision 784.

ssl.c +0 -0
index 85e9c6f..868edc2 100644
@@ -1228,7 +1228,7 @@ init_ssl (const struct options *options)
       int status;
 
Quoted 11 lines

ssl.c init_ssl (const struct options *options) · line 1234

Quoted 7 lines
ssl.c +1 -1
 #if ENABLE_INLINE_FILES
-      if (!strcmp (options->ca_file, INLINE_FILE_TAG) && options->ca_file_inline)
+      if (options->ca_file && !strcmp (options->ca_file, INLINE_FILE_TAG) && options->ca_file_inline)
 	{
 	  status = use_inline_load_verify_locations (ctx, options->ca_file_inline);
 	}

Ciao
Max

This was fixed in 2.1-rc5:

------------------------------------------------------------------------
r2635 | james | 2008-01-20 20:39:01 -0700 (Sun, 20 Jan 2008) | 3 lines Changed paths:
M /branches/BETA21/openvpn/ssl.c

Simple fix where options->ca_file was used without first being checked against NULL.

------------------------------------------------------------------------

James