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

Fix nullpo error in searchstore #2885

Merged
merged 1 commit into from
Nov 16, 2020

Conversation

guilherme-gm
Copy link
Member

Pull Request Prelude

Changes Proposed

Fixes 2 checks in search store function:

  1. it prevents trying to search with an empty item list, this is not even allowed by the client, and makes no sense in the process, as it always start the search by an item. (that's why I put the check on clif)

  2. When searching for an item without asking for cards, it was giving us a nullpo because card_list would be NULL (as it becomes a "0-length array"), but it is a totally valid search (e.g. Searching for an ETC item would never have cards to check for). So I disabled the null pointer check when the card count is zero, from my tests and checking the code, every code called from this would check card count before trying to access the array, so it looks safe.

Issues addressed:
None, i think

src/map/clif.c Outdated Show resolved Hide resolved
src/map/searchstore.c Show resolved Hide resolved
@guilherme-gm
Copy link
Member Author

Thanks for reviewing it! fixed and rebased

@Kenpachi2k13 Kenpachi2k13 added component:core Affecting the Hercules core (i.e. not the game mechanics directly) status:code-review Awaiting code review type:enhancement Issue describes an enhancement or feature that should be implemented labels Oct 30, 2020
@Kenpachi2k13 Kenpachi2k13 added this to the Release v2020.11.16 milestone Oct 30, 2020
@MishimaHaruna MishimaHaruna added the hacktoberfest-accepted Easy-to-tackle issues label Oct 31, 2020
@MishimaHaruna MishimaHaruna merged commit 4e4f66c into HerculesWS:master Nov 16, 2020
@guilherme-gm guilherme-gm deleted the fix-searchstore branch February 24, 2023 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:core Affecting the Hercules core (i.e. not the game mechanics directly) hacktoberfest-accepted Easy-to-tackle issues status:code-review Awaiting code review type:enhancement Issue describes an enhancement or feature that should be implemented
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants