fixes strncpy & buf size

Origin commit data
------------------
Commit: 7359504dd7
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2012-08-07 (Tue, 07 Aug 2012)

Origin message was:
------------------
-fixes strncpy & buf size
This commit is contained in:
Jacek Jendrzej
2012-08-07 18:51:44 +02:00
parent 15881f579e
commit 57a7091601
15 changed files with 48 additions and 44 deletions

View File

@@ -312,8 +312,8 @@ void CZapitClient::getBouquets(BouquetList& bouquets, const bool emptyBouquetsTo
if (!utf_encoded)
{
buffer[30] = (char) 0x00;
strncpy(buffer, response.name, 30);
strncpy(response.name, ZapitTools::UTF8_to_Latin1(buffer).c_str(), 30);
strncpy(buffer, response.name, sizeof(buffer)-1);
strncpy(response.name, ZapitTools::UTF8_to_Latin1(buffer).c_str(), sizeof(buffer)-1);
}
bouquets.push_back(response);
}
@@ -343,8 +343,8 @@ bool CZapitClient::receive_channel_list(BouquetChannelList& channels, const bool
{
char buffer[CHANNEL_NAME_SIZE + 1];
buffer[CHANNEL_NAME_SIZE] = (char) 0x00;
strncpy(buffer, response.name, CHANNEL_NAME_SIZE);
strncpy(response.name, ZapitTools::UTF8_to_Latin1(buffer).c_str(), CHANNEL_NAME_SIZE);
strncpy(buffer, response.name, CHANNEL_NAME_SIZE-1);
strncpy(response.name, ZapitTools::UTF8_to_Latin1(buffer).c_str(), CHANNEL_NAME_SIZE-1);
}
channels.push_back(response);
}