about summary refs log tree commit diff
path: root/sysdeps/i386/strcspn.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/i386/strcspn.S')
-rw-r--r--sysdeps/i386/strcspn.S12
1 files changed, 7 insertions, 5 deletions
diff --git a/sysdeps/i386/strcspn.S b/sysdeps/i386/strcspn.S
index e7529a15c8..b3e5d23091 100644
--- a/sysdeps/i386/strcspn.S
+++ b/sysdeps/i386/strcspn.S
@@ -23,6 +23,7 @@
 
 #include <sysdep.h>
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE		/* no space for saved regs */
@@ -30,11 +31,12 @@
 #define STOP	STR+PTR_SIZE
 
 	.text
-ENTRY (strcspn)
+ENTRY (BP_SYM (strcspn))
 	ENTER
 
 	movl STR(%esp), %edx
 	movl STOP(%esp), %eax
+	CHECK_BOUNDS_LOW (%edx, STR(%esp))
 
 	/* First we create a table with flags for all possible characters.
 	   For the ASCII (7bit/8bit) or ISO-8859-X character sets which are
@@ -169,11 +171,11 @@ L(3):	addl $4, %eax		/* adjust pointer for full loop round */
 L(6):	incl %eax
 L(5):	incl %eax
 
-L(4):	subl %edx, %eax		/* we have to return the number of valid
+L(4):	addl $256, %esp		/* remove stopset */
+	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
+	subl %edx, %eax		/* we have to return the number of valid
 				   characters, so compute distance to first
 				   non-valid character */
-	addl $256, %esp		/* remove stopset */
-
 	LEAVE
 	ret
-END (strcspn)
+END (BP_SYM (strcspn))