I have got this function which converts a month from 3 chars to 2 digits month:
int Extract_Month(char *pDestMonth, char *pMonth)
{
char monthschar[12][4] = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
char monthsdigit[12][3] = { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" };
int i = 0;
char tmpStr[4] = "";
tmpStr[0] = (pMonth[0] >= 'a' && pMonth[0] <= 'z') ? ('a' + pMonth[0] - 'A') : pMonth[0];
tmpStr[1] = (pMonth[1] >= 'a' && pMonth[1] <= 'z') ? ('a' + pMonth[1] - 'A') : pMonth[1];
tmpStr[2] = (pMonth[2] >= 'a' && pMonth[2] <= 'z') ? ('a' + pMonth[2] - 'A') : pMonth[2];
tmpStr[3] = 0;
for (i = 0; i < 12; i++)
{
if (!strncmp(tmpStr, monthschar[i], 3))
{
StrMove((uchar *)pDestMonth, (uchar *)monthsdigit[i], 2);
return 0;
}
}
return -1;
}
I am running it with gdb and I'm getting a segmentation fault error. Does anyone knows what am i missing here?
I have made some research and I found that seg faults are due to memory mishandling.
gdb output points exactly to this function declaration

(pMonth[0] >= 'a' && pMonth[0] <= 'z')? Don't you meanislower()? Or you can just usetoupper().StrMove?