File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 1818 along with python-systemd; If not, see <http://www.gnu.org/licenses/>.
1919***/
2020
21+ #define PY_SSIZE_T_CLEAN
22+ #pragma GCC diagnostic push
23+ #pragma GCC diagnostic ignored "-Wredundant-decls"
2124#include <Python.h>
25+ #pragma GCC diagnostic pop
26+
2227#include <structmember.h>
2328#include <datetime.h>
2429#include <time.h>
@@ -710,11 +715,17 @@ PyDoc_STRVAR(Reader_add_match__doc__,
710715 "Match is a string of the form \"FIELD=value\"." );
711716static PyObject * Reader_add_match (Reader * self , PyObject * args , PyObject * keywds ) {
712717 char * match ;
713- int match_len , r ;
718+ Py_ssize_t match_len ;
719+ int r ;
714720 if (!PyArg_ParseTuple (args , "s#:add_match" , & match , & match_len ))
715721 return NULL ;
716722
717- r = sd_journal_add_match (self -> j , match , match_len );
723+ if (match_len > INT_MAX ) {
724+ set_error (- ENOBUFS , NULL , NULL );
725+ return NULL ;
726+ }
727+
728+ r = sd_journal_add_match (self -> j , match , (int ) match_len );
718729 if (set_error (r , NULL , "Invalid match" ) < 0 )
719730 return NULL ;
720731
You can’t perform that action at this time.
0 commit comments