Skip to content
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

Add check against null? #37

Open
QiAnXinCodeSafe opened this issue Sep 30, 2018 · 0 comments
Open

Add check against null? #37

QiAnXinCodeSafe opened this issue Sep 30, 2018 · 0 comments

Comments

@QiAnXinCodeSafe
Copy link

Hi all,
There is a possible null pointer dereference issue found by Qihoo360 CodeSafe Team.
Details as bellow:

the return value of function FontPointer() may be a null pointer if there's an error.

/* Returns a pointer to the font struct of the number
* returns NULL if theres an error
*/
static BitFont* FontPointer(int FontNumber)

after calling this function, there is no check for error nor check the return pointer against null.

BitFont *CurrentFont = FontPointer(FontType);
/* see how many characters can fit on the screen */
if(x>surface->w || y>surface->h) return;
if(strlen(string) < (unsigned int) (surface->w-x)/CurrentFont->CharWidth)

Cheers
Qihoo360 CodeSafe Team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant