a strange error




i found a strange error
something like

int get_char(char* val, FILE_m* pf)
{char a[512];
int k, i=0, cf1;

la0:;
k=getl_m(a, 512, pf); cf1=cf();
if(k==0){if(cf1==1)
{laa:; printf("\n"); return 0;}
printf("Errore linea troppo lunga");
goto la2;
}
if( (k=sscanf_m(a, "%c", val))!=1 )
if(cf1==1) goto laa;
if( k!=1 )
{la1:;
printf("Errore ");
la2:;
if(++i>=3) goto laa;
printf(": Riprova > ");
goto la0;
}
return 1;
}

int main(void)
{num a[30];
char c;

// /// /// //
cout << "Inserire ?0/s/t/n> ";
get_char(&c, stidn_m);
return 0;
}

/*
EC4 ha provocato un errore di pagina non valida nel
modulo KERNEL32.DLL in 014f:bff9a141.
Registri:
EAX=00570044 CS=014f EIP=bff9a141 EFLGS=00010206
EBX=00000000 SS=0157 ESP=0056ff28 EBP=00570048
ECX=0056fff4 DS=0157 ESI=00570140 FS=3257
EDX=00000000 ES=0157 EDI=00570058 GS=0000
Byte all'indirizzo CS:EIP:
50 51 ff 75 08 8d 85 e0 fe ff ff 50 ff 75 0c e8

50 51 ff 75 08 8d 85 e0 fe ff ff 50 ff 75 0c e8
00000000 50 push eax
00000001 51 push ecx
00000002 FF7508 push dword [ebp+0x8]
00000005 8D85E0FEFFFF lea eax,[ebp+0xfffffee0]
0000000B 50 push eax
0000000C FF750C push dword [ebp+0xc]
0000000F E8 db 0xE8 ; call -0xd2
*/

do you know that this error seems was bound(cause) to my buggy
sscanf_m that wrote &c like an int and not like a char
something like *(int*)c='1'; and not *c="1"
or "mov [ecx], '1' and not mov byte[ecx], 1"
but when i read "&c" like a char array with
show_buf(&c-32, 40); // read *(&c-32) .. *(&c+40) like array of char
first and then, seems all ok the same array
eccept the *byte* value of c in its position
there are two days that search for this error and now seems
all ok for the pc. it seems the OS can see if i write "0" in a
position where there is "0"
.



Relevant Pages