summaryrefslogtreecommitdiff
path: root/plugins/profinet/packet-dcerpc-pn-io.c
diff options
context:
space:
mode:
authorGraham Bloice <graham.bloice@trihedral.com>2017-01-08 21:02:46 +0000
committerAnders Broman <a.broman58@gmail.com>2017-01-09 05:10:47 +0000
commit45d967c803324a50852d4c4615a521e6e245a5dd (patch)
treed1fb0bbef01825759cd65f4c0ef315e89ead2ddd /plugins/profinet/packet-dcerpc-pn-io.c
parentffa239950a3180f103d8d1b6db8550b1b4359566 (diff)
downloadwireshark-45d967c803324a50852d4c4615a521e6e245a5dd.tar.gz
profinet: Skip comments in GSD file
Bug: 13303 Change-Id: I9ab17ec25917723be06b36ab4c11fe67e6792715 Reviewed-on: https://code.wireshark.org/review/19593 Reviewed-by: Graham Bloice <graham.bloice@trihedral.com> Petri-Dish: Graham Bloice <graham.bloice@trihedral.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'plugins/profinet/packet-dcerpc-pn-io.c')
-rw-r--r--plugins/profinet/packet-dcerpc-pn-io.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/plugins/profinet/packet-dcerpc-pn-io.c b/plugins/profinet/packet-dcerpc-pn-io.c
index f94c651865..5af67f3ce3 100644
--- a/plugins/profinet/packet-dcerpc-pn-io.c
+++ b/plugins/profinet/packet-dcerpc-pn-io.c
@@ -90,7 +90,6 @@ void proto_reg_handoff_pn_io(void);
#define MAX_NAMELENGTH 200 /* max. length of the given paths */
-#define MAX_LINE_LENGTH 1024 /* used for fgets() */
#define F_MESSAGE_TRAILER_4BYTE 4 /* PROFIsafe: Defines the Amount of Bytes for CRC and Status-/Controlbyte */
#define PN_INPUT_CR 1 /* PROFINET Input Connect Request value */
#define PN_INPUT_DATADESCRITPION 1 /* PROFINET Input Data Description value */
@@ -9313,7 +9312,7 @@ dissect_ExpectedSubmoduleBlockReq_block(tvbuff_t *tvb, int offset,
if(fp != NULL) {
/* ---- Get VendorID & DeviceID ---- */
- while(fgets(puffer, MAX_LINE_LENGTH, fp) != NULL) {
+ while(pn_fgets(puffer, MAX_LINE_LENGTH, fp) != NULL) {
/* ----- VendorID ------ */
if((strstr(puffer, vendorIdStr)) != NULL) {
memset (convertStr, 0, sizeof(*convertStr));
@@ -9460,7 +9459,7 @@ dissect_ExpectedSubmoduleBlockReq_block(tvbuff_t *tvb, int offset,
fseek(fp, 0, SEEK_SET);
/* Find Indexnumber for fParameter */
- while(fgets(temp, MAX_LINE_LENGTH, fp) != NULL) {
+ while(pn_fgets(temp, MAX_LINE_LENGTH, fp) != NULL) {
if((strstr(temp, fParameterStr)) != NULL) {
memset (convertStr, 0, sizeof(*convertStr));
@@ -9475,7 +9474,7 @@ dissect_ExpectedSubmoduleBlockReq_block(tvbuff_t *tvb, int offset,
memset (temp, 0, sizeof(*temp));
fseek(fp, 0, SEEK_SET); /* Set filepointer to the beginning */
- while(fgets(temp, MAX_LINE_LENGTH, fp) != NULL) {
+ while(pn_fgets(temp, MAX_LINE_LENGTH, fp) != NULL) {
if((strstr(temp, moduleStr)) != NULL) { /* find the String "ModuleIdentNumber=" */
memset (convertStr, 0, sizeof(*convertStr));
pch = strstr(temp, moduleStr); /* search for "ModuleIdentNumber=\"" within GSD-file */
@@ -9486,7 +9485,7 @@ dissect_ExpectedSubmoduleBlockReq_block(tvbuff_t *tvb, int offset,
if (read_module_id == io_data_object->moduleIdentNr) {
++io_data_object->amountInGSDML; /* Save the amount of same (!) Module- & SubmoduleIdentNr in one GSD-file */
- while(fgets(temp, MAX_LINE_LENGTH, fp) != NULL) {
+ while(pn_fgets(temp, MAX_LINE_LENGTH, fp) != NULL) {
if((strstr(temp, moduleNameInfo)) != NULL) { /* find the String "<Name" for the TextID */
long filePosRecord;
@@ -9496,7 +9495,7 @@ dissect_ExpectedSubmoduleBlockReq_block(tvbuff_t *tvb, int offset,
filePosRecord = ftell(fp); /* save the current position of the filepointer (Offset) */
/* ftell() may return -1 for error, don't move fp in this case */
if (filePosRecord >= 0) {
- while (fgets(temp, MAX_LINE_LENGTH, fp) != NULL && io_data_object->amountInGSDML == 1) {
+ while (pn_fgets(temp, MAX_LINE_LENGTH, fp) != NULL && io_data_object->amountInGSDML == 1) {
/* Find a String with the saved TextID and with a fitting value for it in the same line. This value is the name of the Module! */
if(((strstr(temp, tmp_moduletext)) != NULL) && ((strstr(temp, moduleValueInfo)) != NULL)) {
pch = strstr(temp, moduleValueInfo);
@@ -9523,7 +9522,7 @@ dissect_ExpectedSubmoduleBlockReq_block(tvbuff_t *tvb, int offset,
break;
}
else { /* flag is not in the same line as Submoduleidentnumber -> search for it */
- while(fgets(temp, MAX_LINE_LENGTH, fp) != NULL) {
+ while(pn_fgets(temp, MAX_LINE_LENGTH, fp) != NULL) {
if((strstr(temp, profisafeStr)) != NULL) {
io_data_object->profisafeSupported = TRUE;
break; /* Found the PROFIsafeSupported flag of the module */