omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / seed / qualification / security673 / renames-consumer.om
| 1 | note Synthetic issue671 renames consumer. Creates a source file, then renames from stdin packet. |
| 2 | note A malformed packet traps 3; a valid packet renames without replacing. |
| 3 | global pkt uchar 4096 |
| 4 | text src "build/security673-native/ren-src" |
| 5 | text data "x" |
| 6 | fn main to int |
| 7 | fd = fopen src 0 len src 577 384 |
| 8 | if lt fd 0 |
| 9 | ret 90 |
| 10 | end |
| 11 | r = write int fd data 0 1 |
| 12 | if ne r 1 |
| 13 | ret 91 |
| 14 | end |
| 15 | if ne fclose int fd 0 |
| 16 | ret 92 |
| 17 | end |
| 18 | n = ulong read 0 pkt 0 4096 |
| 19 | r = renames pkt 0 n 0 |
| 20 | ret int r |
| 21 | end |