4 Jul
2007
4 Jul
'07
4:33 p.m.
Enrik Berkhan wrote:
I've just noticed that strtok() is used in some places in FreeRADIUS, e.g. in rlm_perl for tokenizing the xlat() arguments. IIRC, strtok() is not thread safe.
There are a bunch of standard C functions with completely broken API.
What would be the best and most portable approach to avoid it? Use strtok_r() if available and/or fall back to a strtok_r implementation provided by FreeRADIUS like mystrtok() in src/lib/valuepair.c?
I think using strtok_r would be best. If it doesn't exist on a system, it can be provided in src/lib/missing.c Alan DeKok.