Management interface -- null-terminated lines
James,
I notice that the management interface terminates its lines \0d \0a \00.
Is the null termination intentional? If so, would you mind documenting it? It caused a few subtle issues until I figured out what was going on, so I wouldn't exactly mind if it went away.
(I'm working on a CLR-based library, and maybe when it works a Gtk# frontend, for interacting w/ OpenVPN via said interface).
Quoted 10 lines · Charles Duffy
James,
I notice that the management interface terminates its lines \0d \0a \00.
Is the null termination intentional? If so, would you mind documenting it? It caused a few subtle issues until I figured out what was going on, so I wouldn't exactly mind if it went away.
(I'm working on a CLR-based library, and maybe when it works a Gtk# frontend, for interacting w/ OpenVPN via said interface).
Aha, good catch... the null termination is a bug, it should just be \0d \0a -- I will fix for beta19.
If you'd like an immediate fix, I've attached a patch.
James
buffer.c +7 -0
@@ -441,11 +441,18 @@#endif {struct buffer buf; + +ASSERT (str); +#ifdef DMALLOC buf_set_read (&buf,string_alloc_debug (str,NULL , file, line),strlen (str) +1 );#else buf_set_read (&buf,string_alloc (str,NULL ),strlen (str) +1 );#endif + +if (buf.len >0 )/* Don't count trailing '\0' as part of length */ + --buf.len; +return buf; }