Skip to content

Instantly share code, notes, and snippets.

View bhaak's full-sized avatar

Patric Mueller bhaak

View GitHub Profile
#include <stdio.h>
#include <string.h>
#define BUFSZ 20
void
strcpy_len(char (*buffer)[BUFSZ], const char* pSrc)
{
strncpy(*buffer, pSrc, BUFSZ);
(*buffer)[BUFSZ-1] = 0;
CC=ccache gcc-9.2.0
CFLAGS=-ggdb -O2 -Wall -Wextra -I../include -DNOTPARMDECL
CFLAGS+=-Werror=format -Werror=implicit-function-declaration -Werror=return-type
CFLAGS+=-Wmisleading-indentation -Wno-shadow -Wno-sign-compare -Wno-unused-variable -Wno-format-overflow
CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wwrite-strings -DGCC_WARN
CFLAGS+=-fno-omit-frame-pointer -fstack-protector-all -fsanitize=undefined -fsanitize=address
CFLAGS+=-DDLB
CFLAGS+=-DCOMPRESS=\"/bin/gzip\" -DCOMPRESS_EXTENSION=\".gz\"
CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
CFLAGS+=-DTIMED_DELAY
==511==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000006df8 at pc 0x7f7b4eda70dd bp 0x7fff97c69550 sp 0x7fff97c69540
WRITE of size 8 at 0x602000006df8 thread T0
#0 0x7f7b4eda70dc in selection_new /home/surf/cvs/nethack/nethack-3.7/src/sp_lev.c:3588
#1 0x7f7b4eb50265 in l_selection_push /home/surf/cvs/nethack/nethack-3.7/src/nhlsel.c:92
#2 0x7f7b4eb52299 in l_selection_new /home/surf/cvs/nethack/nethack-3.7/src/nhlsel.c:112
#3 0x7f7b4eb52299 in params_sel_2coords /home/surf/cvs/nethack/nethack-3.7/src/nhlsel.c:330
#4 0x7f7b4eb52753 in l_selection_fillrect /home/surf/cvs/nethack/nethack-3.7/src/nhlsel.c:420
#5 0x7f7b4f00d3c5 in luaD_precall (/home/surf/nh37/install/games/lib/nethackdir/nethack+0x18013c5)
#6 0x7f7b4f018b4c in luaV_execute (/home/surf/nh37/install/games/lib/nethackdir/nethack+0x180cb4c)
#7 0x7f7b4f00d69e in luaD_call (/home/surf/nh37/install/games/lib/nethackdir/nethack+0x180169e)
diff --git a/wstty.js b/wstty.js
index bba18a7..1685403 100644
--- a/wstty.js
+++ b/wstty.js
@@ -13,13 +13,13 @@ hterm.defaultStorage = new lib.Storage.Memory();
["foreground-color", "#aaaaaa"],
["scrollbar-visible", false],
].forEach(function(v) {
- hterm.PreferenceManager.defaultPreferences[v[0]] = v[1];
+ hterm.PreferenceManager.defaultPreferences[v[0]]['default'] = v[1];
@bhaak
bhaak / fortify_example.s
Created March 4, 2020 10:33
clang -S fortify_example.c
Lcfi2:
.cfi_def_cfa_register %rbp
subq $48, %rsp
movl $8, %eax
movl %eax, %edx
leaq -16(%rbp), %rcx
movq ___stack_chk_guard@GOTPCREL(%rip), %r8
movq (%r8), %r8
movq %r8, -8(%rbp)
movl $0, -20(%rbp)
@bhaak
bhaak / fortify_example.s
Created March 4, 2020 10:36
gcc -O -S fortify_example.c
.file "fortify_example.c"
.text
.globl main
.type main, @function
main:
.LFB34:
.cfi_startproc
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset 3, -16
themerooms = {
{
░-- the "default" room
~ ░ frequency = 1,
░ contents = function()
░ ░des.room({ type = "ordinary", filled = 1 });
░ ░end
},
_
function()
20 2
105 3
223 4
78 5
998 6
44 7
720 8
756 9
642 10
20 11
PREFIX=$(wildcard ~)/eh/install
HACKDIR=$(PREFIX)/games/lib/$(GAME)dir
SHELLDIR = $(PREFIX)/games
INSTDIR=$(HACKDIR)
VARDIR = $(HACKDIR)
POSTINSTALL=cp -n sys/unix/sysconf $(INSTDIR)/sysconf; $(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; chmod $(VARFILEPERM) $(INSTDIR)/sysconf;
CC=gcc-9.3.0
CFLAGS=-ggdb -O2 -Wall -Wextra -I../include -DNOTPARMDECL
root = true
[*]
charset=utf-8
end_of_line=lf
insert_final_newline=false
indent_style=space
indent_size=4
trim_trailing_whitespace = true
max_line_length=78