[Olsr-dev] status tip + BSD
Henning Rogge
(spam-protected)
Thu Jan 29 13:18:37 CET 2009
Am Thursday 29 January 2009 13:00:43 schrieb Sven-Ola Tuecke:
> Hey,
>
> strncpy has a serious sematic flaw which makes it easy to invent bugs. I'm
> used to think "memcpy" instead of "strncpy" - which is normally the right
> thing to think[tm]. Better use something like this:
>
> #if paranoid-about-runtime
> #define strcpy(d, s) (d[sizeof(d) - 1] = 0, strncpy(d, s, sizeof(d) - 1))
> #endif
See src/common/string.c and src/common/autobuf.c
The first one contains strlcpy as source (with the name strscpy ?)...
The second one implements a automatically growing string buffer.
Maybe we could use autobuf in the config parser too ?
Henning
*************************************************
Diplom Informatiker Henning Rogge
Forschungsgesellschaft für
Angewandte Naturwissenschaften e. V. (FGAN)
Neuenahrer Str. 20, 53343 Wachtberg, Germany
Tel.: 0049 (0)228 9435-961
Fax: 0049 (0)228 9435-685
E-Mail: (spam-protected)
Web: www.fgan.de
************************************************
Sitz der Gesellschaft: Bonn
Registergericht: Amtsgericht Bonn VR 2530
Vorstand: Dr. rer. nat. Ralf Dornhaus (Vors.), Prof. Dr. Joachim Ender
(Stellv.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20090129/2326b0f7/attachment.sig>
More information about the Olsr-dev
mailing list