[Openswan dev] openswan-1.0.3 and procfs bug

Sam Sgro sam at spidersilk.net
Fri Apr 23 15:11:30 CEST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On April 22, 2004 09:26 am, Bulba wrote:
> Hi,
> don't have enough time now to create patch, but just to let you
> know:
>
> There seems to be a problem with ipsec_snprintf() in ipsec_proc.c.
> While reading /proc/net/ipsec_eroute pluto complains about:
>
> INTERNAL ERROR: /proc/net/ipsec_eroute line 38 has wrong number of fields
>
> It's all about NUL byte always at position 3071, in the middle of
> ipsec_eroute line.
> ipsec_snprintf seems to NUL-terminate string at (size-1) if string
> will be longer than provided buffer.

This is a real bug, introduced by the initial version of the sprintf() -> 
ipsec_snprintf() changes. The NUL bytes start to pile up as the /proc entries 
grow in size, but they're not visible when the files are small; the /proc 
filesystem uses 3k chunks by default, when the files exceeed 3k, the problems 
accumulate at the boundaries.

This bug was fixed for FreeS/WAN 2.06.

- -- 
Sam Sgro
sam at spidersilk.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAiVxWOyqewpE4gokRAtECAKC9MI5R4M8/Zpe4Mrj7kQFHQt3e9gCeNzrt
j+5pmzjr+e+aQhMvr46GgHA=
=xNQT
-----END PGP SIGNATURE-----



More information about the Dev mailing list