Skip to content

Commit fd72144

Browse files
authoredJan 12, 2023
Fix comment for php_safe_bcmp (#10306)
* main: Fix comment for php_safe_bcmp * main: Include note about php_safe_bcmp being security sensitive This is taken from the implementation of `hash_equals()`.
1 parent 884e8a9 commit fd72144

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎main/safe_bcmp.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <string.h>
2020

2121
/*
22-
* Returns 0 if both inputs match, 1 if they don't.
22+
* Returns 0 if both inputs match, non-zero if they don't.
2323
* Returns -1 early if inputs do not have the same lengths.
2424
*
2525
*/
@@ -34,6 +34,7 @@ PHPAPI int php_safe_bcmp(const zend_string *a, const zend_string *b)
3434
return -1;
3535
}
3636

37+
/* This is security sensitive code. Do not optimize this for speed. */
3738
while (i < ZSTR_LEN(a)) {
3839
r |= ua[i] ^ ub[i];
3940
++i;

0 commit comments

Comments
 (0)