diff Python/sysmodule.c @ 40230:a1863833c4e6 2.5

Backport 52501: Add some asserts. In sysmodule, I think these were to try to silence some warnings from Klokwork. They verify the assumptions of the format of svn version output. The assert in the thread module helped debug a problem on HP-UX.
author Neal Norwitz <nnorwitz@gmail.com>
date Sat, 28 Oct 2006 21:36:37 +0000
parents 6ba402b60041
children 86ab2f20a333
line wrap: on
line diff
--- a/Python/sysmodule.c	Sat Oct 28 16:04:07 2006 +0000
+++ b/Python/sysmodule.c	Sat Oct 28 21:36:37 2006 +0000
@@ -983,6 +983,8 @@
 
 	br_start = python + 8;
 	br_end = strchr(br_start, '/');
+	assert(br_end);
+
 	/* Works even for trunk,
 	   as we are in trunk/Python/sysmodule.c */
 	br_end2 = strchr(br_end+1, '/');
@@ -995,6 +997,8 @@
 	}
 	else if (istag || strncmp(br_start, "branches", 8) == 0) {
 		len = br_end2 - br_start;
+		assert(len >= 13);
+		assert(len < (sizeof(patchlevel_revision) - 13));
 		strncpy(branch, br_start, len);
 		branch[len] = '\0';