library/src/exploitation/WebExploitation/SQLErrCodes/BP-WebExploitPostgresErrCodes.cc
// Generates a list of error code tests based around the
// error code array defined above.  This set is basically
// a string array w/o format strings.
Generates a list of error code tests based around the
error code array defined above.  This set is basically
a string array w/o format strings.
Generates a list of error code tests based around the error code array defined above . This set is basically a string array w / o format strings .
P_BP_FMT_ERR_TESTS BP_PostgresGenErrTestsFromErrCodeArray(P_BP_POSTGRES_ERR_CODES inCodes, size_t numCodes, char **fmtReplacementTable){
	if(!inCodes)
		return NULL;
	size_t i = 0;
	P_BP_FMT_ERR_TESTS genSet = NULL;
	BP_FMT_ERR_TESTS * retSet = NULL;
	BP_POSTGRES_ERR_CODES * testCodes = (P_BP_POSTGRES_ERR_CODES) inCodes;
	for(i = 0; i < numCodes; i++)
	{
		retSet = (BP_FMT_ERR_TESTS *) bprealloc(retSet, ((i+1) * sizeof(BP_FMT_ERR_TESTS)) + sizeof(BP_FMT_ERR_TESTS));
		genSet = BP_GenerateMatchSetFromTestString(testCodes[i].postgresErrStr, bpstrlen(testCodes[i].postgresErrStr), fmtReplacementTable);
		if(!genSet)
			return NULL;
		memcpy(&retSet[i], genSet, sizeof(BP_FMT_ERR_TESTS));
		memset(&retSet[i+1], 0x00, sizeof(BP_FMT_ERR_TESTS));
		bpfree(genSet);
		genSet = NULL;
	}
	return (P_BP_FMT_ERR_TESTS) retSet;
}
P_BP_FMT_ERR_TESTS BP_PostgresGenErrTestsFromErrCodeArray ( P_BP_POSTGRES_ERR_CODES inCodes , size_t numCodes , char * * fmtReplacementTable ) { if ( ! inCodes ) return NULL ; size_t i = 0 ; P_BP_FMT_ERR_TESTS genSet = NULL ; BP_FMT_ERR_TESTS * retSet = NULL ; BP_POSTGRES_ERR_CODES * testCodes = ( P_BP_POSTGRES_ERR_CODES ) inCodes ; for ( i = 0 ; i < numCodes ; i ++ ) { retSet = ( BP_FMT_ERR_TESTS * ) bprealloc ( retSet , ( ( i + 1 ) * sizeof ( BP_FMT_ERR_TESTS ) ) + sizeof ( BP_FMT_ERR_TESTS ) ) ; genSet = BP_GenerateMatchSetFromTestString ( testCodes [ i ] . postgresErrStr , bpstrlen ( testCodes [ i ] . postgresErrStr ) , fmtReplacementTable ) ; if ( ! genSet ) return NULL ; memcpy ( & retSet [ i ] , genSet , sizeof ( BP_FMT_ERR_TESTS ) ) ; memset ( & retSet [ i + 1 ] , 0x00 , sizeof ( BP_FMT_ERR_TESTS ) ) ; bpfree ( genSet ) ; genSet = NULL ; } return ( P_BP_FMT_ERR_TESTS ) retSet ; }
Generates a list of error code tests based around the
error code array defined above.
Generates a list of error code tests based around the error code array defined above .
// set code array pointer into an indexable typedef // increase the size of the return set // generate match set from a string // copy in the array data // zero out trailing item // destroy chunk structure (dont destroy internal pointers) // return the filled out structure