News for hackers. Stuff that matters.
Re:Fleur – A bloom filter implementation in C by shric on Wednesday July 27, 2022 @08:59PM (#32259178)
> There is also strange code like this loop https://github.com/hashlookup/fleur/blob/4ee2644a850381d928a... that jumped into my eye.

The line below that is worse:

strncpy(bloom_path , argv[optind], 128);

If you pass something >= 128 chars then bloom_path won't be null terminated. In general strncpy should never be used for copying strings.

For expansion on that: https://ramblings.implicit.net/c/2014/05/02/c-functions-that...

Re:Fleur – A bloom filter implementation in C by shric on Thursday July 28, 2022 @12:38AM (#32260541)
And I just realised the GP already mentioned the bloom_path issue. Sorry, too late to edit.
Re:Fleur – A bloom filter implementation in C by metadat on Wednesday July 27, 2022 @11:05PM (#32260055)
tl;dr: use strlcpy instead.