aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-s7comm.c
AgeCommit message (Collapse)AuthorFilesLines
2022-11-30wmem: Remove wmem_strbuf_new_label()João Valverde1-1/+1
Only dissectors are using this function and there is no use case, as far as I know, that requires its use. Any limitation of length is imposed transparently by the UI backend. This function is problematic because it is not Unicode aware and will truncate a string on an arbitrary byte boundary for multibyte strings. Replace its use with a normal strbuf without a length limite and remove the function because it is not useful and the ITEM_LABEL_LENGTH parameter does not belong in wmem anyway.
2022-10-26S7Comm: Fix invalid UTF-8 value string charsJoão Valverde1-3/+3
Fixes #18533.
2022-09-29s7comm: Dissector improvements with some new functions and restructuringThomas Wiens1-298/+613
Add some new protocol functions, which needed changes in the existing structure of the parameter part. New protocol functions are USEND, AR_SEND, and a basic dissection of Data record routing. Changed detection of mode transition events. USEND and mode transition events need a special handling (it's all reverse engineered, so it's still not 100 percent correct). Renamed "Prog" to "TIS" (Test and installation), and "Push" to "Indication" to use some of the official terminology. Cleanup of comments due to the changes, and remove some obvious ones.
2022-02-15Tools: Fix fix-encoding-args.pl ASCII string validationJoão Valverde1-25/+25
Do not require a useless ENC_NA parameter for string encodings. FT_STRING and FT_STRINGZ types don't have any ndianness. Follow-up to 6ec429622c9258eefd388caf21ce92ab5b9f54b4.
2022-02-07More descriptive names for some heuristic dissectorsDavid Perry1-1/+1
2021-12-19Replace g_snprintf() with snprintf() (dissectors)João Valverde1-3/+3
Use macros from inttypes.h with format strings.
2021-09-01tvbuff: convert helper methods to pinfo->poolEvan Huus1-1/+1
A few of them just needed scratch memory, so allocate and free it manually after doing any exception-raising checks. A few others were returning memory, and needed conversion to accept a wmem scope argument.
2021-07-21First pass pinfo->pool conversionEvan Huus1-9/+9
Automated find/replace of wmem_packet_scope() with pinfo->pool in all files where it didn't cause a build failure. I also tweaked a few of the docs which got caught up.
2021-04-30Cast away the return value of g_strlcpy() and g_strlcat().Guy Harris1-17/+17
Most of the time, the return value tells us nothing useful, as we've already decided that we're perfectly willing to live with string truncation. Hopefully this keeps Coverity from whining that those routines could return an error code (NARRATOR: They don't) and thus that we're ignoring the possibility of failure (as indicated, we've already decided that we can live with string truncation, so truncation is *NOT* a failure).
2021-02-03S7COMM: remove array size from function interfaceJaap Keuter1-1/+1
Fixes #17198
2020-12-09packet-s7comm: Prevent use of invalid timestampMoshe Kaplan1-29/+39
Detect when the timestamp's month is invalid and avoid accessing the mon_names array out of bounds. This fixes Coverity 1450966.
2020-12-09Fix various spelling errors.Guy Harris1-5/+5
Found by lintian and by looking for the misspelled words that lintian found. (Does not fix spelling errors in .asn1 files.)
2020-09-13More dissector string spelling fixes.Martin Mathieson1-5/+5
Finally, it is becoming difficult to find more.
2020-08-31More spelling fixes, last part of 2nd pass of dissectors.Martin Mathieson1-4/+4
2020-07-147COMM: Try to fix Wpointer-sign warnings.Anders Broman1-25/+25
Change-Id: I5dbd04efab7c0a052b5b0c45c2a4a935fd4c1b42 Reviewed-on: https://code.wireshark.org/review/37856 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-19Fix the type of arrays of pointers to hf_ values for bitfield routines.Guy Harris1-6/+6
The static arrays are supposed to be arrays of const pointers to int, not arrays of non-const pointers to const int. Fixing that means some bugs (scribbling on what's *supposed* to be a const array) will be caught (see packet-ieee80211-radiotap.c for examples, the first of which inspired this change and the second of which was discovered while testing compiles with this change), and removes the need for some annoying casts. Also make some of those arrays static while we're at it. Update documentation and dissector-generator tools. Change-Id: I789da5fc60aadc15797cefecfd9a9fbe9a130ccc Reviewed-on: https://code.wireshark.org/review/37517 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-11-02s7comm: Add read record functionThomas Wiens1-28/+157
Added a new function code for reading a data record. The function parameters are similar to the RDREC call from the s7 plc. It allows to read diagnostic information from a module by it's diagnostic address. Change-Id: If041ed016928136eee75e1154cd87cee27cfd869 Reviewed-on: https://code.wireshark.org/review/34902 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-08-07s7comm: Fix Dead Store (Dead assignement/Dead increment) Warning found by ClangAlexis La Goutte1-4/+0
Change-Id: Iddd57361c9e25e13a28fd86531f6195214a52848 Reviewed-on: https://code.wireshark.org/review/34199 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Thomas Wiens <th.wiens@gmx.de> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-07-26HTTPS (almost) everywhere.Guy Harris1-1/+1
Change all wireshark.org URLs to use https. Fix some broken links while we're at it. Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c Reviewed-on: https://code.wireshark.org/review/34089 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-14s7comm: Adding and redesign of test and installation functionsThomas Wiens1-207/+1675
New decoded TIS-functions: Jobs, BSTACK, ISTACK, LSTACK, Forces, Variable status, block status, breakpoints Change-Id: I7902bfcfe8d622a3e19c0c3b77492e7ad4ddecf5 Reviewed-on: https://code.wireshark.org/review/33927 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-07-13s7comm: Implement packet reassemblyThomas Wiens1-211/+449
Implemented packet reassembly of userdata telegrams. Modified existing functions which before had shown only raw data on fragmented telegrams. Change-Id: Ia8d02928c08ad5228da28ac6a4b4df7ed99ab47e Reviewed-on: https://code.wireshark.org/review/33920 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-07-10s7comm: Additions and name corrections in programming/userdata functionsThomas Wiens1-124/+193
- Rename test and installation (tis) functions to the names used in official documentation - Add PI-Servicenames - Rename vartab to varstat - Variable status: add bit access, change display-style of datablock areas as used in programming software - Add subblock type "none" Change-Id: I465633cbb951311d1d1a59129fe5e3d8dac3f265 Reviewed-on: https://code.wireshark.org/review/33890 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-06-30s7comm: Improved cyclic servicesThomas Wiens1-19/+60
Added a new function code for modifying an existing cyclic job. Show the Job-ID in the info column. Change-Id: I30a5ce0ba03171a947c59b039c9c879b82f3c026 Reviewed-on: https://code.wireshark.org/review/33781 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-04epan: Convert our PROTO_ITEM_ macros to inline functions.Gerald Combs1-1/+1
Convert our various PROTO_ITEM_ macros to inline functions and document them. Change-Id: I070b15d4f70d2189217a177ee8ba2740be36327c Reviewed-on: https://code.wireshark.org/review/32706 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-03s7comm: fix using wrong offset variableThomas Wiens1-1/+1
Change-Id: I9cfd8394e6cbb3f627f7f312fa19fc5baa62f6fc Reviewed-on: https://code.wireshark.org/review/30905 Reviewed-by: Anders Broman <a.broman58@gmail.com> Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2018-11-18s7comm: Add additional syntax ids 0x83 and 0x84 for NCK data accessJuergen Kosel1-4/+11
Beside the standard NCK syntax id 0x82 the ids 0x83 and 0x84 are used for values with metric and inch units. Change-Id: I62bf2d2e583905c9fa90e4e7caa614a6fe6a7155 Signed-off-by: Juergen Kosel <juergen.kosel@gmx.de> Reviewed-on: https://code.wireshark.org/review/30674 Petri-Dish: Anders Broman <a.broman58@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-26s7comm: Remove duplicate entry in event-id listThomas Wiens1-1/+0
Change-Id: I68af3fec94721580d0c9e6c2cf44e45a32fa5b19 Reviewed-on: https://code.wireshark.org/review/30392 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-15dissectors: fix uint to int wrong sign promotion.Dario Lombardo1-1/+1
The result of guint16 * guint16 can lead to a wrong sign promotion, when the result is assigned a uint64. Fixed by forcing the operands to be guint32. CIDs: 1247713 1111813 1111812 1111811 1111810 1111809 1111808 1111807 Change-Id: Ibca08ee3766f6c79b933c3db7ccd1f8f906cb3fe Reviewed-on: https://code.wireshark.org/review/27441 Petri-Dish: Dario Lombardo <lomato@gmail.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-20Fix cpu_diag_eventid_fix_names table.Guy Harris1-3/+3
For a value_string_ext, the values must be in numerical order. Change-Id: I43063b59a8c15d7d1fcdca07d4ae9fd89917427d Reviewed-on: https://code.wireshark.org/review/27058 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-18S7comm: fix range check to prevent infinite loop when upper bound is 255Pascal Quantin1-11/+11
While we are at it, fix identification of not last element in a few places Bug: 14423 Change-Id: I568530949d09ddfd8c5c58d24050dfed32ce10f5 Reviewed-on: https://code.wireshark.org/review/25851 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-02-12dissectors: use SPDX identifiers.Dario Lombardo1-13/+1
Change-Id: I92c94448e6641716d03158a5f332c8b53709423a Reviewed-on: https://code.wireshark.org/review/25756 Petri-Dish: Dario Lombardo <lomato@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-10-31s7comm: Several minor improvementsThomas Wiens1-85/+170
This patch includes several minor improvements: - Special (only for Sinumerik NC): allow NCK address description in data-part - Userdata parameter part: add text definition for second req/res - Don't add data tree in userdata telegrams, when there is no data in there - Cyclic functions: add new subfunction - Alarming: add SCAN message decoding - Improve info column display when there are multiple PDUs in one frame Change-Id: Ib9afd0c6b14cf97ed645084e095f79fb40b07f43 Reviewed-on: https://code.wireshark.org/review/24170 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-10-27s7comm: Syntax-id decoding of frequency inverter parametersThomas Wiens1-192/+275
Add Syntax-id decoding for accessing frequency inverter parameters. Moved the decoding of all other syntax-ids to separate functions. Change-Id: Iba41f0631c4aeaf31a4ec6f73ffc42ca0b76f00d Reviewed-on: https://code.wireshark.org/review/24102 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-04-03Use col_append_str() for fixed stringsStig Bjørlykke1-10/+10
Change from col_append_fstr() to col_append_str() when appending strings without formatting. Change-Id: I8975704c246f2b9a1301ed5f96273aa9d61c6f44 Reviewed-on: https://code.wireshark.org/review/20857 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-11-03Fix lintian found spelling error "occured" -> "occurred"Michael Mann1-2/+2
Change-Id: I6010669b880b772ba4a22f13ba03fe48b438e8b7 Reviewed-on: https://code.wireshark.org/review/18644 Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-11-03Fix lintian found spelling error "splitted" -> "split"Michael Mann1-4/+4
Change-Id: I4b00ef460ae1792cd6f14856493f7a58ab8e0b9a Reviewed-on: https://code.wireshark.org/review/18645 Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-27s7comm: fix fix spelling typo found by lintianAlexis La Goutte1-1/+1
Change-Id: I38da03260d082aaf977f4f32e9206d07e55c1432 Reviewed-on: https://code.wireshark.org/review/18509 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-10-08s7comm: use ws_stroi function.Dario Lombardo1-18/+63
Change-Id: I0d27c2aa7d896c4c6048dff963910ad7f88b07ee Reviewed-on: https://code.wireshark.org/review/18085 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-21Add proto_tree_add_checksum.Michael Mann1-1/+1
This is an attempt to standardize display/handling of checksum fields for all dissectors. The main target is for dissectors that do validation, but dissectors that just report the checksum were also included just to make them easier to find in the future. Bug: 10620 Bug: 12058 Ping-Bug: 8859 Change-Id: Ia8abd86e42eaf8ed50de6b173409e914b17993bf Reviewed-on: https://code.wireshark.org/review/16380 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-01s7comm: Fix Dead Store (Dead assignement/Dead increment) Warning found by ClangAlexis La Goutte1-4/+0
Change-Id: I296d11ec43b3817d30920432239632f86b9f773f Reviewed-on: https://code.wireshark.org/review/16227 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Thomas Wiens <th.wiens@gmx.de> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-27tvb_get_string_enc + proto_tree_add_item = proto_tree_add_item_ret_stringMichael Mann1-16/+11
Also some other tricks to remove unnecessary tvb_get_string_enc calls. Change-Id: I2f40d9175b6c0bb0b1364b4089bfaa287edf0914 Reviewed-on: https://code.wireshark.org/review/16158 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-06-27s7comm: Sinumerik NC file transferThomas Wiens1-1/+117
Added decoding of up-/downloading files from/to a Sinumerik NC CNC control machine. Change-Id: If7939e56e972fc2b8feb12150c4184a880b0cdae Reviewed-on: https://code.wireshark.org/review/16129 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-05-14s7comm: fix warning found by clang analyzerThomas Wiens1-38/+37
Fixed warnings about Dead store / Dead assignment found by clang analyzer. Fixed encoding to be compatible to hf-type. Change-Id: Iba93abe21f87029d53cd1db111b372cd4bd76229 Reviewed-on: https://code.wireshark.org/review/15418 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-05-11s7comm: block/file up-/download redesignThomas Wiens1-235/+1210
Redesigned the block/file up- and download, using new informations from PI-Services. Changed the block-info items, as it's in general a string, which can be further dissected if it's a PLC program block. Other types of Siemens automation hardware may use this as a simple filename for filetransfer. Changed the display-style for block name/number in info-column, to be more compact. Change-Id: Ie7c3a285d25897f8516ed8827041a5dbdf80679e Reviewed-on: https://code.wireshark.org/review/15275 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-05s7comm: Add errorcode descriptions, extended list values, style cleanupThomas Wiens1-165/+300
Added new errorcodes, changed to extended value-string. Removed the defines as they are and will not be used in the code. Add errorcode to info column, if there is an error. Removed the functioncall-tree comment, as it was not up to date. Change-Id: I0abe8eb046b9b2f28e32cf71e214704daa0aa843 Reviewed-on: https://code.wireshark.org/review/15260 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-03-12s7comm: fix 's7comm.cpu.msg.events.modetrans' exists multiple times with NOT ↵Alexis La Goutte1-1/+1
compatible types: FT_BOOLEAN and FT_UINT8 Change-Id: I1fea29ab8813ec69339550a477eb3203f3b5f3aa Reviewed-on: https://code.wireshark.org/review/14421 Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-08Fix a lot of typos and misspellingsmoshekaplan1-6/+6
Change-Id: I8512cfa1d424f82a873a0e0e1d22c7b075fdd7f3 Reviewed-on: https://code.wireshark.org/review/13069 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-04Added/extended handling of CPU message systemThomas Wiens1-31/+1459
The message system includes mode-transition and alarm events by PLC programmed blocks. The IDs in the mode-transition events are the same as used in a SZL response, so I used the same decoding function. Change-Id: If00990c21190ba0bed7933d6c8cfb590c6d8eab2 Reviewed-on: https://code.wireshark.org/review/13032 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-12-07Spelling fixes for errors found by lintianBalint Reczey1-2/+2
Change-Id: I889283902875193f4d3f3fd59788f59f8d9bcc20 Reviewed-on: https://code.wireshark.org/review/11945 Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-10-03Added cotp_is to heuristic dissector list for ISO transport.Thomas Wiens1-0/+1
S7 communication is also possible without TCP/IP. This ISO transport uses the following protocols: LLC->ISO8473->ISO8073->s7comm. The cotp dissector has two subdissector lists. cotp is uses with ISO-on-TCP, cotp_is with ISO transport. Change-Id: Ife543bee8331184d2181b347e683dfc1c2e4a05a Reviewed-on: https://code.wireshark.org/review/10771 Reviewed-by: Michael Mann <mmann78@netscape.net>