SF #633013, Fix NIS causing interpreter core dump
Prevent the lengths passed to PyString_FromStringAndSize() from being negative in some cases.
This commit is contained in:
parent
72a8a3b2b8
commit
662390681e
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue