[GRASS-git] [OSGeo/grass] fddbf9: lib/gis: Fix out of scope memory access error in f...
Mohan Yelugoti
noreply at github.com
Fri Nov 8 04:47:40 PST 2024
Branch: refs/heads/main
Home: https://github.com/OSGeo/grass
Commit: fddbf9f0cb38e4d67b064a8190337c5fe3f8e17c
https://github.com/OSGeo/grass/commit/fddbf9f0cb38e4d67b064a8190337c5fe3f8e17c
Author: Mohan Yelugoti <ymdatta.work at gmail.com>
Date: 2024-11-08 (Fri, 08 Nov 2024)
Changed paths:
M lib/gis/file_name.c
Log Message:
-----------
lib/gis: Fix out of scope memory access error in file_name function call (#4650)
lib/gis: Fix out of scope memory access error in file_name()
When execution takes else path, pname, a pointer, is set to point
to a local variable array which has limited scope. This same
pointer is accessed outside of the block containing the local
variable, essentially creating a scenario where we are accessing
memory outside its score, which is undefined behavior.
Move the variable array out of the loop, so that it has the same
scope as pname.
This was found using cppcheck tool.
Signed-off-by: Mohan Yelugoti <ymdatta.work at gmail.com>
To unsubscribe from these emails, change your notification settings at https://github.com/OSGeo/grass/settings/notifications
More information about the grass-commit
mailing list