summaryrefslogtreecommitdiff
path: root/sysdeps/i386/strpbrk.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/i386/strpbrk.S')
-rw-r--r--sysdeps/i386/strpbrk.S19
1 files changed, 14 insertions, 5 deletions
diff --git a/sysdeps/i386/strpbrk.S b/sysdeps/i386/strpbrk.S
index 59d65540ab..dab1700f15 100644
--- a/sysdeps/i386/strpbrk.S
+++ b/sysdeps/i386/strpbrk.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 */
@@ -31,11 +32,12 @@
#define STOP STR+PTR_SIZE
.text
-ENTRY (strpbrk)
+ENTRY (BP_SYM (strpbrk))
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
@@ -172,10 +174,17 @@ L(5): incl %eax
L(4): addl $256, %esp /* remove stopset */
+ CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
orb %cl, %cl /* was last character NUL? */
- jnz L(7) /* no => return pointer */
- xorl %eax, %eax /* return NULL */
+ jnz L(7) /* no => return pointer */
+ xorl %eax, %eax
+ RETURN_NULL_BOUNDED_POINTER
-L(7): LEAVE
+ LEAVE
RET_PTR
-END (strpbrk)
+
+L(7): RETURN_BOUNDED_POINTER (STR(%esp))
+
+ LEAVE
+ RET_PTR
+END (BP_SYM (strpbrk))