From 793d7c07baaadf4f3ae25bb66bcda5f1acde7c08 Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Mon, 7 Oct 2024 09:30:51 +0200 Subject: [PATCH] fix potential null pointer dereference found by coverity (#187) CID 442478: (#undefined of undefined): Explicit null dereferenced (FORWARD_NULL) 6. var_deref_model: Passing null pointer app to SQLWriteFileDSN, which dereferences it.[show details] 119 ret = SQLWriteFileDSN( file, app, key, str ); --- odbcinst/SQLWriteFileDSN.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odbcinst/SQLWriteFileDSN.c b/odbcinst/SQLWriteFileDSN.c index d280109..cd0b424 100644 --- a/odbcinst/SQLWriteFileDSN.c +++ b/odbcinst/SQLWriteFileDSN.c @@ -116,7 +116,7 @@ BOOL INSTAPI SQLWriteFileDSNW(LPCWSTR lpszFileName, key = lpszKeyName ? _single_string_alloc_and_copy( lpszKeyName ) : (char*)NULL; str = lpszString ? _single_string_alloc_and_copy( lpszString ) : (char*)NULL; - ret = SQLWriteFileDSN( file, app, key, str ); + ret = app ? SQLWriteFileDSN( file, app, key, str ) : FALSE; if ( file ) free( file );