Variable Overflow in UnixWare
Posted on 2000-03-18
I have been facing a very typical problem in SCO's Unixware. the following is a small example
/*** Prev Line commented and Next line added to avoid INDEX Corruption in table odtr -Engineer Mon Dec 20 6:56:43 SST 1999 ***/
if(sff != 1)
ovtm_row.auth_flg = 'Y';
ovtm_row.auth_flg = 'N';
In the above piece of code, there is a variable ovtm_row.remarks. This was initally declared as char(30). and at the time of initalisation it was filled with 80 chars. Here ideally, we were expecting a error, or atleast the program should have generated a core dump, segmentation fault. But instead, the program gets executed without any errors and is affecting the database table index, which is no where linked in the function.
My question is, Should the OS allow such overflowed variables to corrupt the database, and is it really the problem with the OS, or something else.
B'coz, after adding a single line where we are initalising the variable with 30 chars, the problem has been cleared.