mirror of
https://github.com/Tha14/toxic.git
synced 2025-09-18 11:06:53 +02:00
fix potential race conditions
This commit is contained in:
@@ -194,7 +194,7 @@ int valid_nick(char *nick)
|
||||
}
|
||||
|
||||
/* gets base file name from path or original file name if no path is supplied */
|
||||
void get_file_name(char *namebuf, const char *pathname)
|
||||
void get_file_name(char *namebuf, int bufsize, const char *pathname)
|
||||
{
|
||||
int idx = strlen(pathname) - 1;
|
||||
|
||||
@@ -213,7 +213,7 @@ void get_file_name(char *namebuf, const char *pathname)
|
||||
filename = tmpname;
|
||||
}
|
||||
|
||||
snprintf(namebuf, sizeof(namebuf), "%s", filename);
|
||||
snprintf(namebuf, bufsize, "%s", filename);
|
||||
}
|
||||
|
||||
/* converts str to all lowercase */
|
||||
|
Reference in New Issue
Block a user