Commit 14d72d1e authored by Matteo Quintiliani's avatar Matteo Quintiliani
Browse files

Fixed potential buffer overflow


git-svn-id: file:///home/quintiliani/svncopy/nmxptool/trunk@1338 3cd66e75-5955-46cb-a940-c26e5fc5497d
parent 7b3aa69f
......@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it
*
* $Id: nmxp.c,v 1.96 2009-09-01 08:54:03 mtheo Exp $
* $Id: nmxp.c,v 1.97 2010-08-27 07:53:18 mtheo Exp $
*
*/
......@@ -206,8 +206,8 @@ int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST_NET *channelList, in
snprintf(s_channels, MAX_LEN_S_CHANNELS, "%.0f/%d chan %d of %d:",
(double)diff_usec/1000.0, split_channelList.number, i, channelList->number);
for(j=0; j < split_channelList.number; j++) {
strncat(s_channels, " ", MAX_LEN_S_CHANNELS);
strncat(s_channels, NMXP_LOG_STR(split_channelList.channel[j].name), MAX_LEN_S_CHANNELS);
strncat(s_channels, " ", MAX_LEN_S_CHANNELS - strlen(s_channels));
strncat(s_channels, NMXP_LOG_STR(split_channelList.channel[j].name), MAX_LEN_S_CHANNELS - strlen(s_channels));
}
nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_CONNFLOW, "%s\n", s_channels);
ret = nmxp_sendAddTimeSeriesChannel_raw(isock, &split_channelList, shortTermCompletion, out_format, buffer_flag);
......
......@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it
*
* $Id: nmxptool_chanseq.c,v 1.3 2010-08-27 06:56:35 mtheo Exp $
* $Id: nmxptool_chanseq.c,v 1.4 2010-08-27 07:53:18 mtheo Exp $
*
*/
......@@ -120,7 +120,7 @@ void nmxptool_chanseq_save_states(NMXP_CHAN_LIST_NET *chan_list, NMXPTOOL_CHAN_S
if(statefile) {
strncpy(statefilefilename, statefile, MAX_LEN_FILENAME);
strncat(statefilefilename, NMXP_STR_STATE_EXT, MAX_LEN_FILENAME);
strncat(statefilefilename, NMXP_STR_STATE_EXT, MAX_LEN_FILENAME - strlen(statefilefilename));
fstatefile = fopen(statefilefilename, "w");
if(fstatefile == NULL) {
nmxp_log(NMXP_LOG_ERR, NMXP_LOG_D_CHANSTATE, "Unable to write channel states into %s!\n",
......
......@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it
*
* $Id: nmxptool_getoptlong.c,v 1.118 2010-08-27 06:51:27 mtheo Exp $
* $Id: nmxptool_getoptlong.c,v 1.119 2010-08-27 07:53:18 mtheo Exp $
*
*/
......@@ -469,8 +469,8 @@ char *get_channel_list_argument_from_state_file(const char *filename) {
if(ret_channel_string[0] == 0) {
strncpy(ret_channel_string, str_chan, MAXSIZECHANNELSTRINGARGUMENT);
} else {
strncat(ret_channel_string, ",", MAXSIZECHANNELSTRINGARGUMENT);
strncat(ret_channel_string, str_chan, MAXSIZECHANNELSTRINGARGUMENT-3);
strncat(ret_channel_string, ",", MAXSIZECHANNELSTRINGARGUMENT - strlen(ret_channel_string));
strncat(ret_channel_string, str_chan, MAXSIZECHANNELSTRINGARGUMENT - strlen(ret_channel_string));
}
}
fclose(fstatefile);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment