if (file_gets(buf, sizeof(buf), wth->fh) != NULL) {
if (strstr(buf, COSINE_REC_MAGIC_STR1) ||
strstr(buf, COSINE_REC_MAGIC_STR2)) {
- strncpy(hdr, buf, COSINE_LINE_LENGTH-1);
- hdr[COSINE_LINE_LENGTH-1] = '\0';
+ g_strlcpy(hdr, buf, COSINE_LINE_LENGTH);
return cur_off;
}
} else {
} else if (strncmp(direction, "l2-rx", 5) == 0) {
pseudo_header->cosine.direction = COSINE_DIR_RX;
}
- strncpy(pseudo_header->cosine.if_name, if_name,
- COSINE_MAX_IF_NAME_LEN - 1);
+ g_strlcpy(pseudo_header->cosine.if_name, if_name,
+ COSINE_MAX_IF_NAME_LEN);
pseudo_header->cosine.pro = pro;
pseudo_header->cosine.off = off;
pseudo_header->cosine.pri = pri;
iseries_UNICODE_to_ASCII ((guint8 *)data, ISERIES_LINE_LENGTH);
}
/* look for packet header */
- for (i=0; i<8; i++) {
- if (strncmp(data+i,"*",1) == 0)
- strncpy(data+i," ",1);
+ for (i=0; i<8; i++) {
+ if (strncmp(data+i,"*",1) == 0)
+ g_strlcpy(data+i," ",(ISERIES_LINE_LENGTH * 2));
}
num_items_scanned =
sscanf (data,
if (file_gets(buf, sizeof(buf), wth->fh) != NULL) {
if (strstr(buf, NETSCREEN_REC_MAGIC_STR1) ||
strstr(buf, NETSCREEN_REC_MAGIC_STR2)) {
- strncpy(hdr, buf, NETSCREEN_LINE_LENGTH-1);
- hdr[NETSCREEN_LINE_LENGTH-1] = '\0';
+ g_strlcpy(hdr, buf, NETSCREEN_LINE_LENGTH);
return cur_off;
}
} else {
return FALSE;
}
memset(&file_header, 0x00, sizeof(capture_file_header));
- strncpy(file_header.observer_version, network_instruments_magic, 32);
+ g_strlcpy(file_header.observer_version, network_instruments_magic, 32);
file_header.offset_to_first_packet = sizeof(capture_file_header) + sizeof(tlv_header) + strlen(comment);
file_header.offset_to_first_packet = GUINT16_TO_LE(file_header.offset_to_first_packet);
file_header.number_of_information_elements = 1;
vfile_hdr.max_length = htoles(65535);
vfile_hdr.file_flags = htoles(1); /* indexes are present */
vfile_hdr.file_version = htoles(1);
- strncpy(vfile_hdr.description, "Wireshark file", 64);
+ g_strlcpy(vfile_hdr.description, "Wireshark file", 64);
/* Translate the encapsulation type */
switch (wdh->encap)
if (strstr(buf, VMS_REC_MAGIC_STR1) ||
strstr(buf, VMS_REC_MAGIC_STR2) ||
strstr(buf, VMS_REC_MAGIC_STR2)) {
- strncpy(hdr, buf, VMS_LINE_LENGTH-1);
- hdr[VMS_LINE_LENGTH-1] = '\0';
- return cur_off;
+ g_strlcpy(hdr, buf,VMS_LINE_LENGTH);
+ return cur_off;
}
} else {
if (file_eof(wth->fh)) {