1

A simple call to _strlwr from inside strcpy call causes access violation. Here is a example:

int _tmain(int argc, _TCHAR* argv[])
{
char dest[100];
strcpy(dest, _strlwr("TEST_STRING"));   // Violation 
return  0;
}

However no Violation if string is already in lowercase :

int _tmain(int argc, _TCHAR* argv[])
{
char dest[100];
strcpy(dest, _strlwr("test_string"));   // NO Violation 
return  0;
}

Wrote a equivalent code but it works fine:

void foo(const int *x) ;
int *fow(int *x);
int _tmain(int argc, _TCHAR* argv[])
{
int x=4;
foo(fow(&x));
}

void foo(const int *x) {
int LOCAL;
if (x != NULL) {
LOCAL = 3; 
 }
}

int * fow(int *x)
{
*x = 1;
return(x);
}

0 Answers0