Bug 1168938 - Memory safety bug in NetworkUtils::postTetherInterfaceList. r=fabrice

This commit is contained in:
Dimi Lee 2015-07-02 18:17:59 +08:00
Родитель 38dc4dbf00
Коммит 20da5a4b4d
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -819,7 +819,9 @@ void NetworkUtils::postTetherInterfaceList(CommandChain* aChain,
char buf[BUF_SIZE];
NS_ConvertUTF16toUTF8 reason(aResult.mResultReason);
memcpy(buf, reason.get(), reason.Length() + 1);
size_t length = reason.Length() + 1 < BUF_SIZE ? reason.Length() + 1 : BUF_SIZE;
memcpy(buf, reason.get(), length);
split(buf, INTERFACE_DELIMIT, GET_FIELD(mInterfaceList));
doCommand(command, aChain, aCallback);