diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2002-11-04 23:21:09 +0000 |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2002-11-04 23:21:09 +0000 |
commit | 815f48f1441b88418658a1cbbf3c3a4942227988 (patch) | |
tree | 107b2277486d763fcbbd206986604f3ba721dfff /Modules/nismodule.c | |
parent | d11e19008b67c247364b24c2e30cc6b0922dec0e (diff) | |
download | cpython-815f48f1441b88418658a1cbbf3c3a4942227988.tar.gz |
SF #633013, Fix NIS causing interpreter core dump
Prevent the lengths passed to PyString_FromStringAndSize()
from being negative in some cases.
Diffstat (limited to 'Modules/nismodule.c')
-rw-r--r-- | Modules/nismodule.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/nismodule.c b/Modules/nismodule.c index f66e9a1cc6..0a38ee85c5 100644 --- a/Modules/nismodule.c +++ b/Modules/nismodule.c @@ -85,8 +85,10 @@ nis_foreach (int instatus, char *inkey, int inkeylen, char *inval, int err; if (indata->fix) { - inkeylen--; - invallen--; + if (inkeylen > 0 && inkey[inkeylen-1] == '\0') + inkeylen--; + if (invallen > 0 && inval[invallen-1] == '\0') + invallen--; } key = PyString_FromStringAndSize(inkey, inkeylen); val = PyString_FromStringAndSize(inval, invallen); |