Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5355

out of bounds pointer

$
0
0

Hello

I have a problem with a date conversion. Our function is looking like this:

 

 

void GetGlobalMinute(int *iMin)
{
time_t  Datum;
char    caMonth[100]="", temp2[100]="", String[100]="";
char    *temp=(char *)NULL;
int        iDay, iYear, iSek, iStd;

    // Zeitpunkt festhalten
    Datum = time(NULL);

    //
    temp = ctime(&Datum);

    // Datum holen
    sscanf(temp, "%s %s %d %s %d", temp2, caMonth, &iDay, String, &iYear);

    // Stunden und Minuten erstellen
    sscanf(String, "%d:%d:%d", &iStd, iMin, &iSek);

}

Normally this is running fine. No problems with it. But after a couple of days it could happen, that we get a error message like this

 

Assignment out of bounds pointer: 56352487 bytes past end of array on the function of temp = ctime(&Datum);

 

The value of the date is: 3607796771.

 

Then we have a problem with the software.

 

Does anyone know why this happens? How can we avoid this?

 

thanks

Oliver


Viewing all articles
Browse latest Browse all 5355

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>