]> jfr.im git - irc/unrealircd/unrealircd.git/commit
Add strldup() and safestrldup(), reducing ridiculous amount of code in
authorBram Matthys <redacted>
Sun, 22 Apr 2018 13:40:21 +0000 (15:40 +0200)
committerBram Matthys <redacted>
Sun, 22 Apr 2018 13:40:21 +0000 (15:40 +0200)
commitbb4758f3218abb5424769e29b4ff78cefa0fb59c
treef42af4dc1f3427158144135da7638a01ff761efe
parent6990b7d9a6c83b89dc67662e0e48af868964ae5a
Add strldup() and safestrldup(), reducing ridiculous amount of code in
m_pass and m_topic.c when duplicating strings with a length limit.
+/* strldup(str,max) copies a string and ensures the new buffer
+ * is at most 'max' size, including nul byte. The syntax is pretty
+ * much identical to strlcpy() except that the buffer is newly
+ * allocated.
+ * If you wonder why not use strndup() instead?
+ * I feel that mixing code with strlcpy() and strndup() would be
+ * rather confusing since strlcpy() assumes buffer size including
+ * the nul byte and strndup() assumes without the nul byte and
+ * will write one character extra. Hence this strldup(). -- Syzop
+ */
include/common.h
include/h.h
src/modules/m_pass.c
src/modules/m_topic.c
src/scache.c
src/support.c
src/url.c