mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2024-11-10 06:31:47 +00:00
Merge pull request #104 from smcv/mbstowcs
Ensure that mbstowcs does not overflow its buffer
This commit is contained in:
commit
044060274e
1 changed files with 2 additions and 2 deletions
|
@ -146,7 +146,7 @@ void mumble_set_identity(const char* identity)
|
||||||
size_t len;
|
size_t len;
|
||||||
if (!lm)
|
if (!lm)
|
||||||
return;
|
return;
|
||||||
len = MIN(sizeof(lm->identity), strlen(identity)+1);
|
len = MIN(sizeof(lm->identity)/sizeof(wchar_t), strlen(identity)+1);
|
||||||
mbstowcs(lm->identity, identity, len);
|
mbstowcs(lm->identity, identity, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ void mumble_set_description(const char* description)
|
||||||
size_t len;
|
size_t len;
|
||||||
if (!lm)
|
if (!lm)
|
||||||
return;
|
return;
|
||||||
len = MIN(sizeof(lm->description), strlen(description)+1);
|
len = MIN(sizeof(lm->description)/sizeof(wchar_t), strlen(description)+1);
|
||||||
mbstowcs(lm->description, description, len);
|
mbstowcs(lm->description, description, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue