[Python-checkins] python/dist/src/PC/os2vacpp getpathp.c, 1.11,
1.11.36.1
aimacintyre at users.sourceforge.net
aimacintyre at users.sourceforge.net
Sun Dec 12 09:32:44 CET 2004
Update of /cvsroot/python/python/dist/src/PC/os2vacpp
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12235
Modified Files:
Tag: release24-maint
getpathp.c
Log Message:
backport of OS/2 specific fixes related to SF bug # 1003471
Index: getpathp.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/PC/os2vacpp/getpathp.c,v
retrieving revision 1.11
retrieving revision 1.11.36.1
diff -u -d -r1.11 -r1.11.36.1
--- getpathp.c 23 Jul 2001 16:30:27 -0000 1.11
+++ getpathp.c 12 Dec 2004 08:32:41 -0000 1.11.36.1
@@ -83,6 +83,15 @@
}
+/* Add a path component, by appending stuff to buffer.
+ buffer must have at least MAXPATHLEN + 1 bytes allocated, and contain a
+ NUL-terminated string with no more than MAXPATHLEN characters (not counting
+ the trailing NUL). It's a fatal error if it contains a string longer than
+ that (callers must be careful!). If these requirements are met, it's
+ guaranteed that buffer will still be a NUL-terminated string with no more
+ than MAXPATHLEN characters at exit. If stuff is too long, only as much of
+ stuff as fits will be appended.
+*/
static void
join(char *buffer, char *stuff)
{
@@ -94,6 +103,8 @@
if (n > 0 && !is_sep(buffer[n-1]) && n < MAXPATHLEN)
buffer[n++] = SEP;
}
+ if (n > MAXPATHLEN)
+ Py_FatalError("buffer overflow in getpathp.c's joinpath()");
k = strlen(stuff);
if (n + k > MAXPATHLEN)
k = MAXPATHLEN - n;
More information about the Python-checkins
mailing list