servalproject / serval-dna

The Serval Project's core daemon that implements Distributed Numbering Architecture (DNA), MDP, VoMP, Rhizome, MeshMS, etc.
http://servalproject.org
Other
171 stars 80 forks source link

Removed unnecessary null check and wrong empty string checks #91

Closed jonashoechst closed 8 years ago

jonashoechst commented 8 years ago

There where some null checks in referenced structs, that should better be checks for empty strings (in my opinion). Using LLVM those lead to a compiler error.

quixotique commented 8 years ago

Jeremy and Paul, please leave this merge to me.

quixotique commented 8 years ago

Thanks for the patch. I prefer not to use strlen() to test for an empty string, because in the case of a non-empty string it costs more than necessary. Also, one should always think twice about using strlen() on data read directly from input, because it may lead to a potential denial of service bug if the nul terminator is missing. (However, in this case that is not a problem because the strings in question are carefully constructed to always have a nul terminator.)

Fixed by 404cc14 and e770998.