ctty icon indicating copy to clipboard operation
ctty copied to clipboard

ctty_get_name(): fix buffer overrun due to incorrect use of strncpy()

Open srd424 opened this issue 1 year ago • 0 comments

strncpy() will zero-fill the destination up to the size passed - MAX_PATH_LEN, but we only malloc() the actual size of the string, so this overruns and causes heap corruption.

I don't fully understand your approach to string handling, but it seems far easier just to use strdup() here!

Fixes: https://github.com/emptymonkey/shelljack/issues/3

srd424 avatar Aug 31 '24 22:08 srd424