fujinet-firmware icon indicating copy to clipboard operation
fujinet-firmware copied to clipboard

Documentation (wiki) has a buffer overflow (?) bug for example ApeTime C code

Open e474 opened this issue 3 years ago • 2 comments
trafficstars

Hi!

In https://github.com/FujiNetWIFI/fujinet-platformio/wiki/Accessing-the-Real-Time-Clock

there's a test:

if (time_buf[6] != 0) {

on

char time_buf[6];

I'm not sure what is being tested for, so can't suggest a fix, but I think the index into time_buf is too high. Also, maybe check OS.dcb.dstats for a return code as well as (one of) the fields in time_buf?

e474 avatar Feb 07 '22 23:02 e474

@billkendrick ? ^^

tschak909 avatar Mar 17 '22 21:03 tschak909

Good point about the buffer not being large enough. I'll update the wiki page. IIRC I based the C code on what Wade did in Action! & BASIC, and I'm still not super comfortable with SIO calls, so I can't speak to the dstats suggestion. I'd need to dust off my Atari & FujiNet to experiment a bit, I think. (Maybe hack the FN firmware to fail on purpose.) Or, y'know, if someone else wants to do it. ;)

billkendrick avatar Mar 18 '22 04:03 billkendrick

An attempt was made. Thx!

billkendrick avatar Aug 16 '22 07:08 billkendrick