SDL: Use sizeof to determine buffer sizes
I think the use of 2048 was a typo, so this prevents one like that from happening again.
This commit is contained in:
parent
d464bc4dfe
commit
524c594a73
|
@ -366,7 +366,7 @@ FILE* sdlFindFile(const char* name)
|
||||||
|
|
||||||
fprintf(stdout, "Searching for file %s\n", name);
|
fprintf(stdout, "Searching for file %s\n", name);
|
||||||
|
|
||||||
if (GETCWD(buffer, 2048)) {
|
if (GETCWD(buffer, sizeof(buffer))) {
|
||||||
fprintf(stdout, "Searching current directory: %s\n", buffer);
|
fprintf(stdout, "Searching current directory: %s\n", buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,8 +398,8 @@ FILE* sdlFindFile(const char* name)
|
||||||
|
|
||||||
if (path != NULL) {
|
if (path != NULL) {
|
||||||
fprintf(stdout, "Searching PATH\n");
|
fprintf(stdout, "Searching PATH\n");
|
||||||
strncpy(buffer, path, 4096);
|
strncpy(buffer, path, sizeof(buffer));
|
||||||
buffer[4095] = 0;
|
buffer[sizeof(buffer) - 1] = 0;
|
||||||
char* tok = strtok(buffer, PATH_SEP);
|
char* tok = strtok(buffer, PATH_SEP);
|
||||||
|
|
||||||
while (tok) {
|
while (tok) {
|
||||||
|
|
Loading…
Reference in New Issue