Skip to content

Instantly share code, notes, and snippets.

View AndyNovo's full-sized avatar

Andy Novocin AndyNovo

View GitHub Profile
int * data = (int *)malloc(100*sizeof(int));
data[0] = 5;
printIntLine(data[0]);
data = (int *)realloc(data, (130000)*sizeof(int));
if (data != NULL)
{
data[0] = 10;
printIntLine(data[0]);
free(data);
}
char charBuffer[CHAR_BUFFER_SIZE];
cin >> charBuffer;
charBuffer[CHAR_BUFFER_SIZE-1] = '\0';
printLine(charBuffer);
hidden_Error__fscanf_strncpy_84_bad::hidden_Error__fscanf_strncpy_84_bad(int dataCopy)
{
data = dataCopy;
/* POTENTIAL FLAW: Read data from the console using fscanf() */
fscanf(stdin, "%d", &data);
}
hidden_Error__fscanf_strncpy_84_bad::~hidden_Error__fscanf_strncpy_84_bad()
{
{
static const struct {
DWORD winerr;
int doserr;
} doserrors[] =
{
...
};
static void
la_dosmaperr(unsigned long e)
STDMETHODIMP
CCustomAutoComplete::Next(..., ULONG *pceltFetched)
{
...
if (pceltFetched != NULL)
*pceltFetched++;
...
}
#define CONT_MAP_MAX 50
int _iContMap[CONT_MAP_MAX];
...
DockingManager::DockingManager()
{
...
memset(_iContMap, -1, CONT_MAP_MAX);
...
}
if(IsLunaMenuStyle())
if(!xp_space_accelerators) return;
else
if(!original_space_accelerators) return;
...
#!/bin/sh
n_errs=`flawfinder -DQ *.c *.cpp | wc -l`
if [ "$n_errs" = "0" ]; then
exit 0
else
echo "Houston we have a problem"
exit 1
fi
#!/bin/bash
n_errs=`flawfinder -DQ $1 | wc -l`
if [ "$n_errs" = "0" ]; then
echo "No prob bob"
else
echo "Houston we have a problem"
fi
#include "stdio.h"
#include "string.h"
int main(int argc, char **argv)
{
char text[1024];
static int some_value = -72;
strcpy(text, argv[1]); /* ignore the buffer overflow here */