Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Looking at the source, this is where the alarm bells should go off in a reviewer's head:

    memcpy(filter->buffer, output->piu_text_utf8, sizeof(output->piu_text_utf8));
1. memcpy is less safe than memmove and strncpy. strncpy should be used.

2. The two character arrays should use the same constant in defining their length, and that constant should be used both in the struct definitions and here in the copy operation.

3. The code is written in C in spite of it being 2014 at the time.



The code is from an entry in the Underhanded C Contest, it is pretty much a given that the entries will be written in C.


I am aware of that.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: