From: cb at df7cb.de (Christoph Berg) Date: Tue, 27 Mar 2012 12:02:13 +0200 Subject: [Pljava-dev] -Werror=format-security fixes for 1.4.3 Message-ID: <20120327100213.GA21130@msgid.df7cb.de> 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: