BCHS Stack
B → BSD(
OpenBSD
)
C →
C言語
H →
OpenBSD httpd
S →
SQLite
でWebサービスを書く試み。
OpenBSDの
pledge
システムコール
を使っておけばC言語でも安全だろ、とのこと。
code:poc.c
#include
<err.h> /* err(3) */
#include
<stdlib.h> /* EXIT_xxxx */
#include
<stdio.h> /* puts(3) */
#include
<unistd.h> /* pledge(2) */
int
main(void)
{
if (pledge("stdio", NULL) == -1)
err(EXIT_FAILURE, "pledge");
puts("Status: 200 OK\r");
puts("Content-Type: text/html\r");
puts("\r");
puts("Hello, world!\n");
return EXIT_SUCCESS;
}
公式サイト:
https://learnbchs.org/
リポジトリ:
https://github.com/kristapsdz/bchs