Browse Source

TIcket #285 - compilation fixes for '--format-security'

Bug Description:  If you build the make files with -Wformat-security and
                  -Werror=format-security you will hit a few errors:

                   "format not a string literal and no format arguments"

Fix Description:  Corrected the offending functions that were the format parameter.

https://fedorahosted.org/389/ticket/285

Reviewed by: nhosoi(Thanks Noriko!)
Mark Reynolds 13 years ago
parent
commit
68c4ee3248

+ 2 - 2
ldap/servers/plugins/replication/repl5_ruv.c

@@ -1364,7 +1364,7 @@ ruv_dump(const RUV *ruv, char *ruv_name, PRFileDesc *prFile)
 	}
 	else
 	{
-		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, buff);
+		slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "%s", buff);
 	}
 	for (replica = dl_get_first (ruv->elements, &cookie); replica;
 		 replica = dl_get_next (ruv->elements, &cookie))
@@ -1389,7 +1389,7 @@ ruv_dump(const RUV *ruv, char *ruv_name, PRFileDesc *prFile)
 		}
 		else
 		{
-			slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, buff);
+			slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "%s", buff);
 		}
 	}
 

+ 4 - 4
ldap/servers/slapd/passwd_extop.c

@@ -485,7 +485,7 @@ passwd_modify_extop( Slapi_PBlock *pb )
 		errMesg = "Could not get OID value from request.\n";
 		rc = LDAP_OPERATIONS_ERROR;
 		slapi_log_error( SLAPI_LOG_PLUGIN, "passwd_modify_extop", 
-				 errMesg );
+				"%s", errMesg );
 		goto free_and_return;
 	} else {
 	        slapi_log_error( SLAPI_LOG_PLUGIN, "passwd_modify_extop", 
@@ -511,7 +511,7 @@ passwd_modify_extop( Slapi_PBlock *pb )
 		errMesg = "Could not get SASL SSF from connection\n";
 		rc = LDAP_OPERATIONS_ERROR;
 		slapi_log_error( SLAPI_LOG_PLUGIN, "passwd_modify_extop",
-				 errMesg );
+				"%s", errMesg );
 		goto free_and_return;
 	}
 
@@ -519,7 +519,7 @@ passwd_modify_extop( Slapi_PBlock *pb )
 		errMesg = "Could not get local SSF from connection\n";
 		rc = LDAP_OPERATIONS_ERROR;
 		slapi_log_error( SLAPI_LOG_PLUGIN, "passwd_modify_extop",
-				 errMesg );
+				"%s", errMesg );
 		goto free_and_return;
 	}
 
@@ -842,7 +842,7 @@ parse_req_done:
 	/* Free anything that we allocated above */
 free_and_return:
 	slapi_log_error( SLAPI_LOG_PLUGIN, "passwd_modify_extop",
-		errMesg ? errMesg : "success" );
+		"%s", errMesg ? errMesg : "success" );
 
 	if ((rc == LDAP_REFERRAL) && (referrals)) {
 		send_referrals_from_entry(pb, referrals);

+ 5 - 5
lib/base/pool.cpp

@@ -178,7 +178,7 @@ _create_block(int size)
 		crit_exit(freelist_lock);
 		if (((newblock = (block_t *)PERM_MALLOC(sizeof(block_t))) == NULL) || 
 		    ((newblock->data = (char *)PERM_MALLOC(bytes)) == NULL)) {
-			ereport(LOG_CATASTROPHE, XP_GetAdminStr(DBT_poolCreateBlockOutOfMemory_));
+			ereport(LOG_CATASTROPHE, "%s", XP_GetAdminStr(DBT_poolCreateBlockOutOfMemory_));
 			if (newblock)
 				PERM_FREE(newblock);
 			return NULL;
@@ -270,7 +270,7 @@ pool_create()
 		}
 
 		if ( (newpool->curr_block =_create_block(BLOCK_SIZE)) == NULL) {
-			ereport(LOG_CATASTROPHE, XP_GetAdminStr(DBT_poolCreateOutOfMemory_));
+			ereport(LOG_CATASTROPHE, "%s", XP_GetAdminStr(DBT_poolCreateOutOfMemory_));
 			PERM_FREE(newpool);
 			return NULL;
 		}
@@ -291,7 +291,7 @@ pool_create()
 		crit_exit(known_pools_lock);
 	}
 	else 
-		ereport(LOG_CATASTROPHE, XP_GetAdminStr(DBT_poolCreateOutOfMemory_1));
+		ereport(LOG_CATASTROPHE, "%s", XP_GetAdminStr(DBT_poolCreateOutOfMemory_1));
 
 	return (pool_handle_t *)newpool;
 }
@@ -388,7 +388,7 @@ pool_malloc(pool_handle_t *pool_handle, size_t size)
 		 */
 		blocksize = ( (size + BLOCK_SIZE-1) / BLOCK_SIZE ) * BLOCK_SIZE;
 		if ( (pool->curr_block = _create_block(blocksize)) == NULL) {
-			ereport(LOG_CATASTROPHE, XP_GetAdminStr(DBT_poolMallocOutOfMemory_));
+			ereport(LOG_CATASTROPHE, "%s", XP_GetAdminStr(DBT_poolMallocOutOfMemory_));
 #ifdef POOL_LOCKING
 			crit_exit(pool->lock);
 #endif
@@ -410,7 +410,7 @@ pool_malloc(pool_handle_t *pool_handle, size_t size)
 
 void _pool_free_error()
 {
-	ereport(LOG_WARN, XP_GetAdminStr(DBT_freeUsedWherePermFreeShouldHaveB_));
+	ereport(LOG_WARN, "%s", XP_GetAdminStr(DBT_freeUsedWherePermFreeShouldHaveB_));
 
 	return;
 }