From: Rob Browning Date: Sun, 10 Oct 2021 17:08:32 +0000 (-0500) Subject: bup_gethostname: always null terminate X-Git-Url: https://arthur.barton.de/gitweb/?p=bup.git;a=commitdiff_plain;h=1b59a93de5f4f821ce2ce4bfb36eb12d4290a352 bup_gethostname: always null terminate Signed-off-by: Rob Browning Tested-by: Rob Browning --- diff --git a/lib/bup/_helpers.c b/lib/bup/_helpers.c index b5a3c79..330187c 100644 --- a/lib/bup/_helpers.c +++ b/lib/bup/_helpers.c @@ -1895,6 +1895,7 @@ static PyObject *bup_gethostname(PyObject *mod, PyObject *ignore) if (gethostname(buf, sizeof(buf) - 1)) return PyErr_SetFromErrno(PyExc_IOError); + buf[sizeof(buf) - 1] = 0; return PyBytes_FromString(buf); }