Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 75e0145

Browse files
author
Andrew MacIntyre
committed
- DosSetExtLIBPATH objects to a NULL pointer, but a pointer to a NULL
string does what is expected (ie unset [BEGIN|END]LIBPATH) - set the size of the DosQuerySysInfo buffer correctly; it was safe, but incorrect (allowing a 1 element overrun)
1 parent 5549322 commit 75e0145

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

Modules/posixmodule.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5410,19 +5410,13 @@ posix_putenv(PyObject *self, PyObject *args)
54105410
if (stricmp(s1, "BEGINLIBPATH") == 0) {
54115411
APIRET rc;
54125412

5413-
if (strlen(s2) == 0) /* If New Value is an Empty String */
5414-
s2 = NULL; /* Then OS/2 API Wants a NULL to Undefine It */
5415-
54165413
rc = DosSetExtLIBPATH(s2, BEGIN_LIBPATH);
54175414
if (rc != NO_ERROR)
54185415
return os2_error(rc);
54195416

54205417
} else if (stricmp(s1, "ENDLIBPATH") == 0) {
54215418
APIRET rc;
54225419

5423-
if (strlen(s2) == 0) /* If New Value is an Empty String */
5424-
s2 = NULL; /* Then OS/2 API Wants a NULL to Undefine It */
5425-
54265420
rc = DosSetExtLIBPATH(s2, END_LIBPATH);
54275421
if (rc != NO_ERROR)
54285422
return os2_error(rc);
@@ -7265,7 +7259,7 @@ static int insertvalues(PyObject *module)
72657259
char *ver, tmp[50];
72667260

72677261
Py_BEGIN_ALLOW_THREADS
7268-
rc = DosQuerySysInfo(1, QSV_MAX, &values[1], sizeof(values));
7262+
rc = DosQuerySysInfo(1L, QSV_MAX, &values[1], sizeof(ULONG) * QSV_MAX);
72697263
Py_END_ALLOW_THREADS
72707264

72717265
if (rc != NO_ERROR) {

0 commit comments

Comments
 (0)