diff --git a/src/daemonc/remotecontrol.cpp b/src/daemonc/remotecontrol.cpp index f057ceec8..d6659148d 100644 --- a/src/daemonc/remotecontrol.cpp +++ b/src/daemonc/remotecontrol.cpp @@ -520,13 +520,13 @@ void CRemoteControl::processAPIDnames() if ( current_PIDs.APIDs[count].is_ac3 ) { if(!strstr(current_PIDs.APIDs[count].desc, " (AC3)")) - strncat(current_PIDs.APIDs[count].desc, " (AC3)", DESC_MAX_LEN - strlen(current_PIDs.APIDs[count].desc)); + strncat(current_PIDs.APIDs[count].desc, " (AC3)", DESC_MAX_LEN - strlen(current_PIDs.APIDs[count].desc)-1); has_ac3 = true; if(g_settings.audio_DolbyDigital && (ac3_found < 0)) ac3_found = count; } else if (current_PIDs.APIDs[count].is_aac && !strstr(current_PIDs.APIDs[count].desc, " (AAC)")) - strncat(current_PIDs.APIDs[count].desc, " (AAC)", DESC_MAX_LEN - strlen(current_PIDs.APIDs[count].desc)); + strncat(current_PIDs.APIDs[count].desc, " (AAC)", DESC_MAX_LEN - strlen(current_PIDs.APIDs[count].desc)-1); } if ( has_unresolved_ctags ) @@ -548,11 +548,11 @@ void CRemoteControl::processAPIDnames() // workaround for buggy ZDF ctags / or buggy sectionsd/drivers , who knows... if(!tags[i].component.empty()) { - strncpy(current_PIDs.APIDs[j].desc, tags[i].component.c_str(), DESC_MAX_LEN); + strncpy(current_PIDs.APIDs[j].desc, tags[i].component.c_str(), DESC_MAX_LEN-1); if (current_PIDs.APIDs[j].is_ac3 && !strstr(current_PIDs.APIDs[j].desc, " (AC3)")) - strncat(current_PIDs.APIDs[j].desc, " (AC3)", DESC_MAX_LEN - strlen(current_PIDs.APIDs[j].desc)); + strncat(current_PIDs.APIDs[j].desc, " (AC3)", DESC_MAX_LEN - strlen(current_PIDs.APIDs[j].desc)-1); else if (current_PIDs.APIDs[j].is_aac && !strstr(current_PIDs.APIDs[j].desc, " (AAC)")) - strncat(current_PIDs.APIDs[j].desc, " (AAC)", DESC_MAX_LEN - strlen(current_PIDs.APIDs[j].desc)); + strncat(current_PIDs.APIDs[j].desc, " (AAC)", DESC_MAX_LEN - strlen(current_PIDs.APIDs[j].desc)-1); } current_PIDs.APIDs[j].component_tag = -1; break; diff --git a/src/driver/netfile.cpp b/src/driver/netfile.cpp index e42e310d6..2b6303cb2 100644 --- a/src/driver/netfile.cpp +++ b/src/driver/netfile.cpp @@ -1059,6 +1059,7 @@ FILE *f_open(const char *filename, const char *acctype) for(int i=0; ((ptr != NULL) && (i<25)); ptr = strstr(ptr, "http://") ) { strncpy(servers[i], ptr, 1023); + servers[i][1023] = '\0'; ptr2 = strchr(servers[i], '\n'); if(ptr2) *ptr2 = 0; // change ptr so that next strstr searches in buf and not in servers[i] @@ -1300,6 +1301,7 @@ const char *f_type(FILE *stream, const char *type) { stream_type[i].stream = stream; strncpy(stream_type[i].type, type, 64); + stream_type[i].type[64] = '\0'; dprintf(stderr, "added entry (%s) for %p\n", type, stream); } return type; @@ -1720,7 +1722,8 @@ void ShoutCAST_ParseMetaData(char *md, CSTATE *state) if(!ptr) { ptr = strchr(md, '='); - strncpy(state->title, ptr + 2, 4096); + strncpy(state->title, ptr + 2, 4095); + state->title[4095] = '\0'; ptr = strchr(state->title, ';'); if(ptr) *(ptr - 1) = 0; @@ -1736,7 +1739,8 @@ void ShoutCAST_ParseMetaData(char *md, CSTATE *state) ptr = strstr(md, "StreamTitle="); ptr = strchr(ptr, '\''); - strncpy(state->artist, ptr + 1, 4096); + strncpy(state->artist, ptr + 1, 4095); + state->artist[4095] = '\0'; ptr = strstr(state->artist, " - "); if(!ptr) ptr = strstr(state->artist, ", "); diff --git a/src/driver/record.cpp b/src/driver/record.cpp index b9dffde8a..269a4b442 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -320,7 +320,7 @@ void CRecordInstance::GetPids(CZapitChannel * channel) for (uint32_t i = 0; i < channel->getAudioChannelCount(); i++) { CZapitClient::responseGetAPIDs response; response.pid = channel->getAudioPid(i); - strncpy(response.desc, channel->getAudioChannel(i)->description.c_str(), DESC_MAX_LEN); + strncpy(response.desc, channel->getAudioChannel(i)->description.c_str(), DESC_MAX_LEN - 1); response.is_ac3 = response.is_aac = 0; if (channel->getAudioChannel(i)->audioChannelType == CZapitAudioChannel::AC3) { response.is_ac3 = 1; @@ -343,12 +343,12 @@ void CRecordInstance::ProcessAPIDnames() has_unresolved_ctags= true; if ( strlen( allpids.APIDs[count].desc ) == 3 ) - strncpy( allpids.APIDs[count].desc, getISO639Description( allpids.APIDs[count].desc ),DESC_MAX_LEN ); + strncpy( allpids.APIDs[count].desc, getISO639Description( allpids.APIDs[count].desc ),DESC_MAX_LEN -1 ); if ( allpids.APIDs[count].is_ac3 && !strstr(allpids.APIDs[count].desc, " (AC3)")) - strncat(allpids.APIDs[count].desc, " (AC3)", DESC_MAX_LEN - strlen(allpids.APIDs[count].desc)); + strncat(allpids.APIDs[count].desc, " (AC3)", DESC_MAX_LEN - strlen(allpids.APIDs[count].desc) -1); else if (allpids.APIDs[count].is_aac && !strstr(allpids.APIDs[count].desc, " (AAC)")) - strncat(allpids.APIDs[count].desc, " (AAC)", DESC_MAX_LEN - strlen(allpids.APIDs[count].desc)); + strncat(allpids.APIDs[count].desc, " (AAC)", DESC_MAX_LEN - strlen(allpids.APIDs[count].desc) -1); } if(has_unresolved_ctags && (epgid != 0)) { @@ -358,11 +358,11 @@ void CRecordInstance::ProcessAPIDnames() for(unsigned int j=0; j< allpids.APIDs.size(); j++) { if(allpids.APIDs[j].component_tag == tags[i].componentTag) { if(!tags[i].component.empty()) { - strncpy(allpids.APIDs[j].desc, tags[i].component.c_str(), DESC_MAX_LEN); + strncpy(allpids.APIDs[j].desc, tags[i].component.c_str(), DESC_MAX_LEN -1); if (allpids.APIDs[j].is_ac3 && !strstr(allpids.APIDs[j].desc, " (AC3)")) - strncat(allpids.APIDs[j].desc, " (AC3)", DESC_MAX_LEN - strlen(allpids.APIDs[j].desc)); + strncat(allpids.APIDs[j].desc, " (AC3)", DESC_MAX_LEN - strlen(allpids.APIDs[j].desc)-1); else if (allpids.APIDs[j].is_aac && !strstr(allpids.APIDs[j].desc, " (AAC)")) - strncat(allpids.APIDs[j].desc, " (AAC)", DESC_MAX_LEN - strlen(allpids.APIDs[j].desc)); + strncat(allpids.APIDs[j].desc, " (AAC)", DESC_MAX_LEN - strlen(allpids.APIDs[j].desc)-1); } allpids.APIDs[j].component_tag = -1; break; @@ -598,16 +598,16 @@ record_error_msg_t CRecordInstance::MakeFileName(CZapitChannel * channel) if (errno == ENOENT) { res = safe_mkdir(filename); if (res == 0) - strncat(filename,"/",FILENAMEBUFFERSIZE - strlen(filename)); + strncat(filename,"/",FILENAMEBUFFERSIZE - strlen(filename) -1); else perror("[vcrcontrol] mkdir"); } else perror("[vcrcontrol] stat"); } else // directory exists - strncat(filename,"/",FILENAMEBUFFERSIZE - strlen(filename)); + strncat(filename,"/",FILENAMEBUFFERSIZE - strlen(filename)-1); } else - strncat(filename, "_",FILENAMEBUFFERSIZE - strlen(filename)); + strncat(filename, "_",FILENAMEBUFFERSIZE - strlen(filename)-1); } pos = strlen(filename); @@ -631,7 +631,7 @@ record_error_msg_t CRecordInstance::MakeFileName(CZapitChannel * channel) pos += strftime(&(filename[pos]), sizeof(filename) - pos - 1, "%Y%m%d_%H%M%S", localtime(&t)); if(autoshift) - strncat(filename, "_temp",FILENAMEBUFFERSIZE - strlen(filename)); + strncat(filename, "_temp",FILENAMEBUFFERSIZE - strlen(filename)-1); return RECORD_OK; } diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index 532d3ecb1..6cfb749f6 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -533,7 +533,7 @@ std::string CBEBouquetWidget::inputName(const char * const defaultName, const ne { char Name[30]; - strncpy(Name, defaultName, 30); + strncpy(Name, defaultName, sizeof(Name)-1); CStringInputSMS * nameInput = new CStringInputSMS(caption, Name, 29, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-.,:|!?/ "); nameInput->exec(this, ""); diff --git a/src/gui/bookmarkmanager.cpp b/src/gui/bookmarkmanager.cpp index 6f11db53e..d7f81a167 100644 --- a/src/gui/bookmarkmanager.cpp +++ b/src/gui/bookmarkmanager.cpp @@ -247,7 +247,7 @@ const CBookmark * CBookmarkManager::getBookmark(CMenuTarget* parent) listmaxshow=bookmarks.size(); height = theight+0+listmaxshow*fheight*2; // recalc height } - if (!(bookmarks.empty() && selected==bookmarks.size())) + if ((!bookmarks.empty() && selected==bookmarks.size())) { selected=bookmarks.size()-1; liststart = (selected/listmaxshow)*listmaxshow; diff --git a/src/gui/motorcontrol.cpp b/src/gui/motorcontrol.cpp index c36e16096..6c42ab6d4 100644 --- a/src/gui/motorcontrol.cpp +++ b/src/gui/motorcontrol.cpp @@ -138,7 +138,7 @@ int CMotorControl::exec(CMenuTarget* parent, const std::string &) for(sit = satellitePositions.begin(); sit != satellitePositions.end(); sit++) { if(!strcmp(sit->second.name.c_str(),scansettings.satNameNoDiseqc)) { sat.position = sit->first; - strncpy(sat.satName, scansettings.satNameNoDiseqc, 50); + strncpy(sat.satName, scansettings.satNameNoDiseqc, 49); satList.push_back(sat); if(sit->second.motor_position) motorPosition = sit->second.motor_position; @@ -148,7 +148,7 @@ int CMotorControl::exec(CMenuTarget* parent, const std::string &) #endif /* send satellite list to zapit */ sat.position = CServiceManager::getInstance()->GetSatellitePosition(scansettings.satNameNoDiseqc); - strncpy(sat.satName, scansettings.satNameNoDiseqc, 50); + strncpy(sat.satName, scansettings.satNameNoDiseqc, 49); satList.push_back(sat); satellite_map_t & satmap = frontend->getSatellites(); diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index 976bb32c7..219d90c2f 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -2884,7 +2884,7 @@ int CMovieBrowser::showMovieInfoMenu(MI_MOVIE_INFO* movie_info) if(movie_info != NULL) { - strncpy(dirItNr, m_dirNames[movie_info->dirItNr].c_str(),BUFFER_SIZE); + strncpy(dirItNr, m_dirNames[movie_info->dirItNr].c_str(),BUFFER_SIZE-1); snprintf(size,BUFFER_SIZE,"%5llu",movie_info->file.Size>>20); } @@ -3448,7 +3448,7 @@ CMenuSelector::CMenuSelector(const char * OptionName, const bool Active , std::s height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); optionValueString = &OptionValue; optionName = OptionName; - strncpy(buffer,OptionValue.c_str(),BUFFER_MAX); + strncpy(buffer,OptionValue.c_str(),BUFFER_MAX-1); buffer[BUFFER_MAX-1] = 0;// terminate string optionValue = buffer; active = Active; diff --git a/src/gui/movieinfo.cpp b/src/gui/movieinfo.cpp index d9489cfa9..e5c4f0912 100644 --- a/src/gui/movieinfo.cpp +++ b/src/gui/movieinfo.cpp @@ -83,7 +83,7 @@ bool CMovieInfo::convertTs2XmlName(char *char_filename, int size) bool result = false; std::string filename = char_filename; if (convertTs2XmlName(&filename) == true) { - strncpy(char_filename, filename.c_str(), size); + strncpy(char_filename, filename.c_str(), size-1); char_filename[size - 1] = 0; result = true; } diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index ec6c133a5..75324cfd1 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -232,14 +232,14 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) } else if(manual || !scan_all) { sat.position = CServiceManager::getInstance()->GetSatellitePosition(scansettings.satNameNoDiseqc); - strncpy(sat.satName, scansettings.satNameNoDiseqc, 50); + strncpy(sat.satName, scansettings.satNameNoDiseqc, 49); satList.push_back(sat); } else { satellite_map_t & satmap = CServiceManager::getInstance()->SatelliteList(); for(sit = satmap.begin(); sit != satmap.end(); ++sit) { if(sit->second.use_in_scan) { sat.position = sit->first; - strncpy(sat.satName, sit->second.name.c_str(), 50); + strncpy(sat.satName, sit->second.name.c_str(), 49); satList.push_back(sat); } } diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index ea7cbbc77..07396e261 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -501,7 +501,7 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) sprintf (buf, "20:9"); break; default: - strncpy (buf, g_Locale->getText (LOCALE_STREAMINFO_ARATIO_UNKNOWN), sizeof (buf)); + strncpy (buf, g_Locale->getText (LOCALE_STREAMINFO_ARATIO_UNKNOWN), sizeof (buf)-1); } g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR, 0, true); // UTF-8 @@ -535,7 +535,7 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) snprintf (buf,sizeof(buf), "60fps"); break; default: - strncpy (buf, g_Locale->getText (LOCALE_STREAMINFO_FRAMERATE_UNKNOWN), sizeof (buf)); + strncpy (buf, g_Locale->getText (LOCALE_STREAMINFO_FRAMERATE_UNKNOWN), sizeof (buf)-1); break; } g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width, buf, COL_INFOBAR, 0, true); // UTF-8 diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 282e6d4b1..45803538a 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -327,7 +327,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) recinfo.recordingSafety = false; timerNew.announceTime-= 120; // 2 more mins for rec timer - strncpy(recinfo.recordingDir,timerNew.recordingDir,sizeof(recinfo.recordingDir)); + strncpy(recinfo.recordingDir,timerNew.recordingDir,sizeof(recinfo.recordingDir)-1); data = &recinfo; } else data= &eventinfo; @@ -364,7 +364,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) "%n", &timerNew.channel_id, &delta); - strncpy(timerNew_channel_name, &(key[3 + delta + 1]), 30); + strncpy(timerNew_channel_name, &(key[3 + delta + 1]), 29); g_RCInput->postMsg(CRCInput::RC_timeout, 0); // leave underlying menu also g_RCInput->postMsg(CRCInput::RC_timeout, 0); // leave underlying menu also return menu_return::RETURN_EXIT; @@ -1052,7 +1052,7 @@ int CTimerList::modifyTimer() //printf("TIMER: rec dir %s len %s\n", timer->recordingDir, strlen(timer->recordingDir)); if (!strlen(timer->recordingDir)) - strncpy(timer->recordingDir,g_settings.network_nfs_recordingdir,sizeof(timer->recordingDir)); + strncpy(timer->recordingDir,g_settings.network_nfs_recordingdir,sizeof(timer->recordingDir)-1); bool recDirEnabled = (timer->eventType == CTimerd::TIMER_RECORD) && (g_settings.recording_type == RECORDING_FILE); CMenuForwarder* m6 = new CMenuForwarder(LOCALE_TIMERLIST_RECORDING_DIR, recDirEnabled, timer->recordingDir, this, "rec_dir1", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); @@ -1102,7 +1102,7 @@ int CTimerList::newTimer() timerNew.channel_id = 0; strcpy(timerNew.message, ""); timerNew_standby_on =false; - strncpy(timerNew.recordingDir,g_settings.network_nfs_recordingdir,sizeof(timerNew.recordingDir)); + strncpy(timerNew.recordingDir,g_settings.network_nfs_recordingdir,sizeof(timerNew.recordingDir)-1); CMenuWidget timerSettings(LOCALE_TIMERLIST_MENUNEW, NEUTRINO_ICON_SETTINGS); diff --git a/src/gui/update_settings.cpp b/src/gui/update_settings.cpp index 93ca1fd8d..bf187c935 100644 --- a/src/gui/update_settings.cpp +++ b/src/gui/update_settings.cpp @@ -89,7 +89,7 @@ int CUpdateSettings::exec(CMenuTarget* parent, const std::string &actionKey) fileFilter.addFilter("urls"); fileBrowser.Filter = &fileFilter; if (fileBrowser.exec("/var/etc") == true) - strncpy(g_settings.softupdate_url_file, fileBrowser.getSelectedFile()->Name.c_str(), 31); + strncpy(g_settings.softupdate_url_file, fileBrowser.getSelectedFile()->Name.c_str(), 30); return res; } diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index dd0b00cc1..b973b7eb0 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1634,7 +1634,7 @@ CMenuOptionLanguageChooser::~CMenuOptionLanguageChooser() int CMenuOptionLanguageChooser::exec(CMenuTarget*) { - strncpy(g_settings.language, optionValue.c_str(), sizeof(g_settings.language)); + strncpy(g_settings.language, optionValue.c_str(), sizeof(g_settings.language)-1); if(observ) observ->changeNotify(LOCALE_LANGUAGESETUP_SELECT, (void *) optionValue.c_str()); return menu_return::RETURN_EXIT; diff --git a/src/zapit/lib/zapitclient.cpp b/src/zapit/lib/zapitclient.cpp index a1aab9988..b5ed35828 100644 --- a/src/zapit/lib/zapitclient.cpp +++ b/src/zapit/lib/zapitclient.cpp @@ -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); } diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index bc5b8aa94..a7ae43bfd 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -911,7 +911,7 @@ bool CZapit::ParseCommand(CBasicMessage::Header &rmsg, int connfd) CZapitChannel * channel = (requested_channel_id == 0) ? current_channel : CServiceManager::getInstance()->FindChannel(requested_channel_id); if(channel) { - strncpy(response.name, channel->getName().c_str(), CHANNEL_NAME_SIZE); + strncpy(response.name, channel->getName().c_str(), CHANNEL_NAME_SIZE-1); response.name[CHANNEL_NAME_SIZE-1] = 0; } CBasicServer::send_data(connfd, &response, sizeof(response)); @@ -1053,7 +1053,7 @@ bool CZapit::ParseCommand(CBasicMessage::Header &rmsg, int connfd) satellite_map_t satmap = CServiceManager::getInstance()->SatelliteList(); for(sat_iterator_t sit = satmap.begin(); sit != satmap.end(); sit++) { - strncpy(sat.satName, sit->second.name.c_str(), 50); + strncpy(sat.satName, sit->second.name.c_str(), 49); sat.satName[49] = 0; sat.satPosition = sit->first; sat.motorPosition = sit->second.motor_position; @@ -1561,7 +1561,7 @@ void CZapit::sendAPIDs(int connfd) for (uint32_t i = 0; i < current_channel->getAudioChannelCount(); i++) { CZapitClient::responseGetAPIDs response; response.pid = current_channel->getAudioPid(i); - strncpy(response.desc, current_channel->getAudioChannel(i)->description.c_str(), DESC_MAX_LEN); + strncpy(response.desc, current_channel->getAudioChannel(i)->description.c_str(), DESC_MAX_LEN-1); response.is_ac3 = response.is_aac = 0; if (current_channel->getAudioChannel(i)->audioChannelType == CZapitAudioChannel::AC3) { response.is_ac3 = 1; @@ -1597,7 +1597,7 @@ void CZapit::internalSendChannels(int connfd, ZapitChannelList* channels, const } } else { CZapitClient::responseGetBouquetChannels response; - strncpy(response.name, ((*channels)[i]->getName()).c_str(), CHANNEL_NAME_SIZE); + strncpy(response.name, ((*channels)[i]->getName()).c_str(), CHANNEL_NAME_SIZE-1); response.name[CHANNEL_NAME_SIZE-1] = 0; //printf("internalSendChannels: name %s\n", response.name); response.satellitePosition = (*channels)[i]->getSatellitePosition(); @@ -1640,7 +1640,7 @@ void CZapit::sendBouquets(int connfd, const bool emptyBouquetsToo, CZapitClient: ((curMode & TV_MODE) && !g_bouquetManager->Bouquets[i]->tvChannels.empty())))) { msgBouquet.bouquet_nr = i; - strncpy(msgBouquet.name, g_bouquetManager->Bouquets[i]->Name.c_str(), 30); + strncpy(msgBouquet.name, g_bouquetManager->Bouquets[i]->Name.c_str(), 29); msgBouquet.name[29] = 0; msgBouquet.locked = g_bouquetManager->Bouquets[i]->bLocked; msgBouquet.hidden = g_bouquetManager->Bouquets[i]->bHidden;