agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
Subject: [Pljava-dev] -Werror=format-security fixes for 1.4.3
Date: Tue, 27 Mar 2012 12:02:13 +0200
Message-ID: <20120327100213.GA21130@msgid.df7cb.de> (raw)

Hi,

here's a patch that fixes build failures with gcc -Werror=format-security

Christoph
-- 
cb at df7cb.de | http://www.df7cb.de/
-------------- next part --------------
--- postgresql-pljava-1.4.3.orig/src/C/pljava/JNICalls.c
+++ postgresql-pljava-1.4.3/src/C/pljava/JNICalls.c
@@ -71,7 +71,7 @@ static void elogExceptionMessage(JNIEnv*
 		}
 	}
 	jniEnv = saveEnv;
-	ereport(logLevel, (errcode(sqlState), errmsg(buf.data)));
+	ereport(logLevel, (errcode(sqlState), errmsg("%s", buf.data)));
 }
 
 static void printStacktrace(JNIEnv* env, jobject exh)
--- postgresql-pljava-1.4.3.orig/src/C/pljava/Backend.c
+++ postgresql-pljava-1.4.3/src/C/pljava/Backend.c
@@ -211,7 +211,7 @@ static jint JNICALL my_vfprintf(FILE* fp
  	++ep;
  	*ep = 0;
 
-    elog(s_javaLogLevel, buf);
+    elog(s_javaLogLevel, "%s", buf);
     return 0;
 }
 
@@ -274,14 +274,14 @@ static void appendPathParts(const char*
 		if(HashMap_getByString(unique, pathPart) == 0)
 		{
 			if(HashMap_size(unique) == 0)
-				appendStringInfo(bld, prefix);
+				appendStringInfo(bld, "%s", prefix);
 			else
 #if defined(WIN32)
 				appendStringInfoChar(bld, ';');
 #else
 				appendStringInfoChar(bld, ':');
 #endif
-			appendStringInfo(bld, pathPart);
+			appendStringInfo(bld, "%s", pathPart);
 			HashMap_putByString(unique, pathPart, (void*)1);
 		}
 		pfree(pathPart);
@@ -907,7 +907,7 @@ JNICALL Java_org_postgresql_pljava_inter
 	
 		PG_TRY();
 		{
-			elog(logLevel, str);
+			elog(logLevel, "%s", str);
 			pfree(str);
 		}
 		PG_CATCH();
--- postgresql-pljava-1.4.3.orig/src/C/pljava/Exception.c
+++ postgresql-pljava-1.4.3/src/C/pljava/Exception.c
@@ -52,7 +52,7 @@ Exception_featureNotSupported(const char
 		appendStringInfoString(&buf, ". It was introduced in version ");
 		appendStringInfoString(&buf, introVersion);
 	
-		ereport(DEBUG3, (errmsg(buf.data)));
+		ereport(DEBUG3, (errmsg("%s", buf.data)));
 		jmsg = String_createJavaStringFromNTS(buf.data);
 	
 		ex = JNI_newObject(UnsupportedOperationException_class, UnsupportedOperationException_init, jmsg);
@@ -78,7 +78,7 @@ void Exception_throw(int errCode, const
 
 	va_start(args, errMessage);
 	vsnprintf(buf, sizeof(buf), errMessage, args);
-	ereport(DEBUG3, (errcode(errCode), errmsg(buf)));
+	ereport(DEBUG3, (errcode(errCode), errmsg("%s", buf)));
 
 	PG_TRY();
 	{
@@ -118,7 +118,7 @@ void Exception_throwIllegalArgument(cons
 
 	va_start(args, errMessage);
 	vsnprintf(buf, sizeof(buf), errMessage, args);
-	ereport(DEBUG3, (errmsg(buf)));
+	ereport(DEBUG3, (errmsg("%s", buf)));
 
 	PG_TRY();
 	{
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20120327/c8a79974/attachment.bin;



view thread (2+ messages)  latest in thread

Message-ID: <20120327100213.GA21130@msgid.df7cb.de>
Permalink:  ../20120327100213.GA21130@msgid.df7cb.de/
Also on:    postgresql.org/message-id/20120327100213.GA21130@msgid.df7cb.de

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pljava-dev@postgresql.org
  Subject: Re: [Pljava-dev] -Werror=format-security fixes for 1.4.3
  In-Reply-To: <20120327100213.GA21130@msgid.df7cb.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox