News for hackers. Stuff that matters.
Re:Do not expose your RIGOL oscilloscopes to the internet by jacquesm on Sunday July 16, 2023 @02:37PM (#36750130)
Many of these faults are simply the consequence of never reading the manpage of a function but making assumptions about implementation details of an imaginary version of a function with the same name.
Re:Do not expose your RIGOL oscilloscopes to the internet by fest on Sunday July 16, 2023 @06:16PM (#36751966)
Though, in this case, manpage doesn't exactly spell out that two strings of which one is 0 chars long results in a match.

I often remember my PHP days in horror, but mysqli_query manpage does warn you about SQL-injections now.

Re:Do not expose your RIGOL oscilloscopes to the internet by jacquesm on Sunday July 16, 2023 @09:08PM (#36753001)
It does actually.

"The strncmp() function is similar, except it compares only the first (at most) n bytes of s1 and s2."

Possibly it's years of string wrangling in C that sets me up here for being biased towards the compact way in which the C manpages state what the function will do, but 'early termination' because of zero length strings for comparisions returns 0 just as sure as comparing "" and "" would. And that 0 indicates a match...

Re:Do not expose your RIGOL oscilloscopes to the internet by fest on Wednesday July 19, 2023 @06:13PM (#36794211)
Of course an experienced developer would have thought about edge cases, but I can see a thought process like: ok, I'm comparing two strings. "" != "123" in languages with built-in string types.

I'm definitely not arguing that C shouldn't be used and everybody should be using <insert-the-currently-trendy-systems-programming-language>: just thinking out loud if improved documentation could prevent at least some of the common footguns.