Commit d8c5d154 authored by Matteo Quintiliani's avatar Matteo Quintiliani

Substitude strcpy() with strncpy()


git-svn-id: file:///home/quintiliani/svncopy/nmxptool/trunk@1230 3cd66e75-5955-46cb-a940-c26e5fc5497d
parent d2b823a8
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy * Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it * quintiliani@ingv.it
* *
* $Id: nmxptool.c,v 1.210 2009-03-10 14:34:57 mtheo Exp $ * $Id: nmxptool.c,v 1.211 2009-03-10 16:44:59 mtheo Exp $
* *
*/ */
...@@ -380,9 +380,9 @@ int main (int argc, char **argv) { ...@@ -380,9 +380,9 @@ int main (int argc, char **argv) {
nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_EXTRA, "%s.%s.%s\n", nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_EXTRA, "%s.%s.%s\n",
NMXP_LOG_STR(NETCODE_OR_CURRENT_NETWORK), NMXP_LOG_STR(station_code), NMXP_LOG_STR(channel_code)); NMXP_LOG_STR(NETCODE_OR_CURRENT_NETWORK), NMXP_LOG_STR(station_code), NMXP_LOG_STR(channel_code));
strcpy(msr_list_chan[i_chan]->network, NETCODE_OR_CURRENT_NETWORK); strncpy(msr_list_chan[i_chan]->network, NETCODE_OR_CURRENT_NETWORK, 11);
strcpy(msr_list_chan[i_chan]->station, station_code); strncpy(msr_list_chan[i_chan]->station, station_code, 11);
strcpy(msr_list_chan[i_chan]->channel, channel_code); strncpy(msr_list_chan[i_chan]->channel, channel_code, 11);
msr_list_chan[i_chan]->reclen = 512; /* byte record length */ msr_list_chan[i_chan]->reclen = 512; /* byte record length */
msr_list_chan[i_chan]->encoding = DE_STEIM1; /* Steim 1 compression */ msr_list_chan[i_chan]->encoding = DE_STEIM1; /* Steim 1 compression */
......
...@@ -105,9 +105,9 @@ int nmxptool_ew_pd2ewring (NMXP_DATA_PROCESS *pd, SHM_INFO *pregionOut, MSG_LOGO ...@@ -105,9 +105,9 @@ int nmxptool_ew_pd2ewring (NMXP_DATA_PROCESS *pd, SHM_INFO *pregionOut, MSG_LOGO
tbuf.trh2.endtime = (tbuf.trh2.starttime + tbuf.trh2.endtime = (tbuf.trh2.starttime +
((tbuf.trh2.nsamp - 1) / tbuf.trh2.samprate)); ((tbuf.trh2.nsamp - 1) / tbuf.trh2.samprate));
strcpy(tbuf.trh2.net, pd->network); strncpy(tbuf.trh2.net, pd->network, TRACE2_NET_LEN);
strcpy(tbuf.trh2.sta, pd->station); strncpy(tbuf.trh2.sta, pd->station, TRACE2_STA_LEN);
strcpy(tbuf.trh2.chan, pd->channel); strncpy(tbuf.trh2.chan, pd->channel, TRACE2_CHAN_LEN);
strncpy(tbuf.trh2.loc, LOC_NULL_STRING, 2); strncpy(tbuf.trh2.loc, LOC_NULL_STRING, 2);
...@@ -139,9 +139,9 @@ int nmxptool_ew_pd2ewring (NMXP_DATA_PROCESS *pd, SHM_INFO *pregionOut, MSG_LOGO ...@@ -139,9 +139,9 @@ int nmxptool_ew_pd2ewring (NMXP_DATA_PROCESS *pd, SHM_INFO *pregionOut, MSG_LOGO
tbuf.trh.endtime = (tbuf.trh.starttime + tbuf.trh.endtime = (tbuf.trh.starttime +
((tbuf.trh.nsamp - 1) / tbuf.trh.samprate)); ((tbuf.trh.nsamp - 1) / tbuf.trh.samprate));
strcpy(tbuf.trh.net, pd->network); strncpy(tbuf.trh.net, pd->network, TRACE_NET_LEN);
strcpy(tbuf.trh.sta, pd->station); strncpy(tbuf.trh.sta, pd->station, TRACE_STA_LEN);
strcpy(tbuf.trh.chan, pd->channel); strncpy(tbuf.trh.chan, pd->channel, TRACE_CHAN_LEN);
/* The decoding always produces 32-bit integers in host byte order */ /* The decoding always produces 32-bit integers in host byte order */
#ifdef _INTEL #ifdef _INTEL
...@@ -336,7 +336,7 @@ int nmxptool_ew_proc_configfile (char * configfile, NMXPTOOL_PARAMS *params) { ...@@ -336,7 +336,7 @@ int nmxptool_ew_proc_configfile (char * configfile, NMXPTOOL_PARAMS *params) {
return EW_FAILURE; return EW_FAILURE;
} }
strcpy (myModName, str); strncpy (myModName, str, MAXMODNAMELEN);
/* Lookup module ID */ /* Lookup module ID */
if ( GetModId( myModName, &myModId) != 0 ) { if ( GetModId( myModName, &myModId) != 0 ) {
...@@ -354,7 +354,7 @@ int nmxptool_ew_proc_configfile (char * configfile, NMXPTOOL_PARAMS *params) { ...@@ -354,7 +354,7 @@ int nmxptool_ew_proc_configfile (char * configfile, NMXPTOOL_PARAMS *params) {
return EW_FAILURE; return EW_FAILURE;
} }
strcpy (ringName, str); strncpy (ringName, str, MAXRINGNAMELEN);
} }
} }
......
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