-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Port fix for a segfault #17
base: master
Are you sure you want to change the base?
Port fix for a segfault #17
Conversation
381748a
to
7ffe91b
Compare
@@ -386,8 +386,7 @@ static const KmouseProt exps2Prot = { | |||
#define PSM_4DPLUS_ID 8 | |||
|
|||
static const unsigned char ps2_init[] = { | |||
PSMC_ENABLE_DEV, | |||
0, | |||
PSMC_ENABLE_DEV |
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.
how does removing these 0's fix a segfault ?
this commit changes 4 things, but none of the changes are explained. |
I can make separate commits. I assumed you would prefer having all changes in a single commit. |
e504a2c
to
c344bd6
Compare
This fixes an incorrect loop condtion, as it is possible to skip over NUM_PROT when incrementing This causes a segfault in kdrive, when km->i_prot would have to loop, instead continuing to read out of bounds. I couldn't get tinyx to also segfault, but that doesn't mean it's impossible. It might happen on different hardware.
c344bd6
to
5f3cd22
Compare
Done. |
We know the size of the ps/2 init bytes at compile time. No need to call strlen.
a32f227
to
c8fd8e5
Compare
This fixes a segfault in the kdrive mouse driver.
I haven't managed to get tinyx to segfault, because the ability to pass mouse protocol by command line args seems to not be implemented.
Still, this doesn't mean that the segfault can't happen here too. It doesn't happen on my system because the default ps/2 protocol works fine for me. However, this might not be the case on other systems.
This code fixes an incorrect loop condition and adds a fallback for unknown mouse protocols.
Also replaces strlen with sizeof appropriately.