Also properly check the return value of read() and leave room
for termination.
Fixes junk data occasionally seen in strings read through systemd.
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <
1460606013-4983-1-git-send-email-selva.nair@gmail.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11437
Signed-off-by: Gert Doering <gert@greenie.muc.de>
if ((std_out = openvpn_popen (&argv, NULL)) < 0) {
return false;
}
- CLEAR (*input);
- if (read (std_out, input, capacity) != 0)
+
+ memset (input, 0, capacity);
+ if (read (std_out, input, capacity-1) > 0)
{
chomp (input);
ret = true;