mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 01:43:01 +01:00
fix possible buffer overflow
This commit is contained in:
parent
1b49a89c8e
commit
445f5aa1fd
@ -252,8 +252,15 @@ static void chat_onFileSendRequest(ToxWindow *self, Tox *m, int32_t num, uint8_t
|
||||
filename[len] = '\0';
|
||||
char d[9];
|
||||
sprintf(d, "(%d)", count++);
|
||||
int d_len = strlen(d);
|
||||
|
||||
if (len + d_len >= sizeof(filename)) {
|
||||
len -= d_len;
|
||||
filename[len] = '\0';
|
||||
}
|
||||
|
||||
strcat(filename, d);
|
||||
filename[len + strlen(d)] = '\0';
|
||||
filename[len + d_len] = '\0';;
|
||||
|
||||
if (count > 999) {
|
||||
errmsg = "Error saving file to disk.";
|
||||
|
Loading…
Reference in New Issue
Block a user