-
Couldn't load subscription status.
- Fork 8k
Fix GH-13984: Buffer size is now checked before memcmp #13991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| --TEST-- | ||
| Fix GH-13984: Buffer size is now checked before memcmp | ||
| --EXTENSIONS-- | ||
| pdo_sqlite | ||
| --FILE-- | ||
| <?php | ||
| $dbfile = 'z.db'; | ||
|
||
| $db = new PDO('sqlite:' . $dbfile, null, null, [PDO::ATTR_PERSISTENT => true]); | ||
| echo 'done!'; | ||
| ?> | ||
| --CLEAN-- | ||
| <?php | ||
| @unlink(getcwd() . '/z.db'); | ||
|
||
| ?> | ||
| --EXPECT-- | ||
| done! | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
))))was too hard to see, so I added!= 0. The meaning remains the same.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong,
sizeof(filename)is not the length, it is the size of the pointer.I also think the
!= 0addition is wrong formemcmp?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why bothering with memcmp anyway ? why not just any str*cmp ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nielsdos
Right. I entered sizeof with the intention of strlen...
Since it becomes true when
1and-1, it seems to be the same because it becomes true when!= 0, but am I wrong?@devnexen
I thought I had to convert it to zend_string, but there were some that could be used as char, so I fixed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I misread the original condition. So !=0 is fine.