libosdp 3.2.3__tar.gz → 3.2.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. {libosdp-3.2.3 → libosdp-3.2.5}/PKG-INFO +1 -1
  2. {libosdp-3.2.3 → libosdp-3.2.5}/libosdp.egg-info/PKG-INFO +1 -1
  3. {libosdp-3.2.3 → libosdp-3.2.5}/setup.py +1 -1
  4. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_config.h +4 -4
  5. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_cp.c +4 -2
  6. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_file.c +22 -2
  7. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_phy.c +25 -4
  8. {libosdp-3.2.3 → libosdp-3.2.5}/MANIFEST.in +0 -0
  9. {libosdp-3.2.3 → libosdp-3.2.5}/README.md +0 -0
  10. {libosdp-3.2.3 → libosdp-3.2.5}/libosdp.egg-info/SOURCES.txt +0 -0
  11. {libosdp-3.2.3 → libosdp-3.2.5}/libosdp.egg-info/dependency_links.txt +0 -0
  12. {libosdp-3.2.3 → libosdp-3.2.5}/libosdp.egg-info/top_level.txt +0 -0
  13. {libosdp-3.2.3 → libosdp-3.2.5}/osdp/__init__.py +0 -0
  14. {libosdp-3.2.3 → libosdp-3.2.5}/osdp/channel.py +0 -0
  15. {libosdp-3.2.3 → libosdp-3.2.5}/osdp/constants.py +0 -0
  16. {libosdp-3.2.3 → libosdp-3.2.5}/osdp/control_panel.py +0 -0
  17. {libosdp-3.2.3 → libosdp-3.2.5}/osdp/helpers.py +0 -0
  18. {libosdp-3.2.3 → libosdp-3.2.5}/osdp/key_store.py +0 -0
  19. {libosdp-3.2.3 → libosdp-3.2.5}/osdp/peripheral_device.py +0 -0
  20. {libosdp-3.2.3 → libosdp-3.2.5}/pyproject.toml +0 -0
  21. {libosdp-3.2.3 → libosdp-3.2.5}/setup.cfg +0 -0
  22. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/include/osdp.h +0 -0
  23. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/include/osdp_export.h +0 -0
  24. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/python/osdp_sys/base.c +0 -0
  25. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/python/osdp_sys/cp.c +0 -0
  26. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/python/osdp_sys/data.c +0 -0
  27. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/python/osdp_sys/module.c +0 -0
  28. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/python/osdp_sys/module.h +0 -0
  29. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/python/osdp_sys/pd.c +0 -0
  30. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/python/osdp_sys/utils.c +0 -0
  31. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/crypto/tinyaes.c +0 -0
  32. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/crypto/tinyaes_src.c +0 -0
  33. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/crypto/tinyaes_src.h +0 -0
  34. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_common.c +0 -0
  35. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_common.h +0 -0
  36. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_diag.c +0 -0
  37. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_diag.h +0 -0
  38. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_file.h +0 -0
  39. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_pd.c +0 -0
  40. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_sc.c +0 -0
  41. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/include/utils/assert.h +0 -0
  42. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/include/utils/crc16.h +0 -0
  43. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/include/utils/disjoint_set.h +0 -0
  44. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/include/utils/list.h +0 -0
  45. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/include/utils/logger.h +0 -0
  46. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/include/utils/pcap_gen.h +0 -0
  47. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/include/utils/queue.h +0 -0
  48. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/include/utils/slab.h +0 -0
  49. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/include/utils/utils.h +0 -0
  50. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/src/crc16.c +0 -0
  51. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/src/disjoint_set.c +0 -0
  52. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/src/list.c +0 -0
  53. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/src/logger.c +0 -0
  54. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/src/pcap_gen.c +0 -0
  55. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/src/queue.c +0 -0
  56. {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/src/utils.c +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libosdp
3
- Version: 3.2.3
3
+ Version: 3.2.5
4
4
  Summary: Library implementation of IEC 60839-11-5 OSDP (Open Supervised Device Protocol)
5
5
  Home-page: https://github.com/goToMain/libosdp
6
6
  Author: Siddharth Chandrasekaran
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libosdp
3
- Version: 3.2.3
3
+ Version: 3.2.5
4
4
  Summary: Library implementation of IEC 60839-11-5 OSDP (Open Supervised Device Protocol)
5
5
  Home-page: https://github.com/goToMain/libosdp
6
6
  Author: Siddharth Chandrasekaran
@@ -12,7 +12,7 @@ import shutil
12
12
  import subprocess
13
13
 
14
14
  project_name = "libosdp"
15
- project_version = "3.2.3"
15
+ project_version = "3.2.5"
16
16
  current_dir = os.path.dirname(os.path.realpath(__file__))
17
17
  repo_root = os.path.realpath(os.path.join(current_dir, ".."))
18
18
 
@@ -11,11 +11,11 @@
11
11
  * @brief The following macros are defined defined from the variable in cmake
12
12
  * files. All @XXX@ are replaced by the value of XXX as resolved by cmake.
13
13
  */
14
- #define PROJECT_VERSION "3.2.3"
14
+ #define PROJECT_VERSION "3.2.5"
15
15
  #define PROJECT_NAME "libosdp"
16
- #define GIT_BRANCH "release_v3.2"
17
- #define GIT_REV "a4079c9"
18
- #define GIT_TAG ""
16
+ #define GIT_BRANCH "detached"
17
+ #define GIT_REV "v3.2.5-0-gdc4b8da"
18
+ #define GIT_TAG "v3.2.5"
19
19
  #define GIT_DIFF ""
20
20
  #define REPO_ROOT "/home/runner/work/libosdp/libosdp"
21
21
 
@@ -573,7 +573,8 @@ static int cp_decode_response(struct osdp_pd *pd, uint8_t *buf, int len)
573
573
  event.type = OSDP_EVENT_KEYPRESS;
574
574
  event.keypress.reader_no = buf[pos++];
575
575
  event.keypress.length = buf[pos++];
576
- if ((len - REPLY_KEYPAD_DATA_LEN) != event.keypress.length) {
576
+ if (event.keypress.length != (len - REPLY_KEYPAD_DATA_LEN) ||
577
+ event.keypress.length > OSDP_EVENT_KEYPRESS_MAX_DATALEN) {
577
578
  break;
578
579
  }
579
580
  memcpy(event.keypress.data, buf + pos, event.keypress.length);
@@ -591,7 +592,8 @@ static int cp_decode_response(struct osdp_pd *pd, uint8_t *buf, int len)
591
592
  event.cardread.length = bread_u16_le(buf, &pos);
592
593
  event.cardread.direction = 0; /* un-specified */
593
594
  t = (event.cardread.length + 7) / 8; /* len: bytes */
594
- if (t != (len - REPLY_RAW_DATA_LEN)) {
595
+ if (t != (len - REPLY_RAW_DATA_LEN) ||
596
+ t > OSDP_EVENT_CARDREAD_MAX_DATALEN) {
595
597
  break;
596
598
  }
597
599
  memcpy(event.cardread.data, buf + pos, t);
@@ -218,7 +218,12 @@ int osdp_file_cmd_tx_decode(struct osdp_pd *pd, uint8_t *buf, int len)
218
218
  xfer.offset = bread_u32_le(buf, &pos);
219
219
  xfer.length = bread_u16_le(buf, &pos);
220
220
  assert(pos == sizeof(struct osdp_cmd_file_xfer));
221
- assert(xfer.length + pos == len);
221
+
222
+ if (xfer.length > (uint16_t)(len - FILE_TRANSFER_HEADER_SIZE)) {
223
+ LOG_ERR("TX_Decode: declared length %d exceeds %d bytes present",
224
+ xfer.length, len - FILE_TRANSFER_HEADER_SIZE);
225
+ return -1;
226
+ }
222
227
 
223
228
  if (f->state == OSDP_FILE_IDLE || f->state == OSDP_FILE_DONE) {
224
229
  if (pd->command_callback) {
@@ -253,6 +258,15 @@ int osdp_file_cmd_tx_decode(struct osdp_pd *pd, uint8_t *buf, int len)
253
258
  return -1;
254
259
  }
255
260
 
261
+ /* Bound the wire offset and length against the declared file size
262
+ * before handing them to the write handler, so a peer cannot make it
263
+ * write outside the file it announced. */
264
+ if ((uint64_t)xfer.offset + xfer.length > f->size) {
265
+ LOG_ERR("TX_Decode: chunk off:%d len:%d exceeds size:%d",
266
+ xfer.offset, xfer.length, f->size);
267
+ return -1;
268
+ }
269
+
256
270
  f->length = f->ops.write(f->ops.arg, data, xfer.length, xfer.offset);
257
271
  if (f->length != xfer.length) {
258
272
  LOG_ERR("TX_Decode: user write failed! rc:%d len:%d off:%d",
@@ -296,7 +310,13 @@ int osdp_file_cmd_stat_build(struct osdp_pd *pd, uint8_t *buf, int max_len)
296
310
  }
297
311
  LOG_DBG("length: %d offset: %d size: %d", f->length, f->offset, f->size);
298
312
  f->length = 0;
299
- assert(f->offset <= f->size);
313
+
314
+ /*
315
+ * Don't assert f->offset:w <= f->size: a legitimately retransmitted
316
+ * chunk (lost FTSTAT) re-drives the running offset and can transiently
317
+ * overshoot. The write-side bound in tx_decode is the real guard.
318
+ */
319
+
300
320
  if (f->offset == f->size) { /* EOF */
301
321
  if (f->ops.close(f->ops.arg) < 0) {
302
322
  LOG_ERR("Stat_Build: Close failed!");
@@ -466,6 +466,7 @@ static bool phy_rescan_packet_buf(struct osdp_pd *pd)
466
466
  static int phy_check_header(struct osdp_pd *pd)
467
467
  {
468
468
  int ret, len;
469
+ unsigned long need;
469
470
  uint8_t cur_byte = 0, prev_byte = 0;
470
471
  uint8_t *buf = pd->packet_buf;
471
472
 
@@ -491,10 +492,19 @@ static int phy_check_header(struct osdp_pd *pd)
491
492
  prev_byte = cur_byte;
492
493
  }
493
494
 
494
- /* Found start of a new packet; wait until we have atleast the header */
495
- len = osdp_rb_pop_buf(pd->rx.rb, buf + pd->packet_buf_len,
496
- sizeof(struct osdp_packet_header) - 1);
497
- pd->packet_buf_len += len;
495
+ /*
496
+ * Found start of a new packet; top up only the header bytes still
497
+ * missing. On re-entry with a partially collected header, popping a
498
+ * fixed sizeof(header)-1 bytes would overshoot packet_buf_len past the
499
+ * packet and wedge the framer (see osdp_phy_check_packet()).
500
+ */
501
+ need = sizeof(struct osdp_packet_header) +
502
+ (buf[0] == OSDP_PKT_MARK ? 1 : 0);
503
+ if (pd->packet_buf_len < need) {
504
+ len = osdp_rb_pop_buf(pd->rx.rb, buf + pd->packet_buf_len,
505
+ need - pd->packet_buf_len);
506
+ pd->packet_buf_len += len;
507
+ }
498
508
 
499
509
  /* Validate header using shared function */
500
510
  ret = phy_validate_header(pd, buf, pd->packet_buf_len, OSDP_PACKET_BUF_SIZE);
@@ -672,6 +682,17 @@ int osdp_phy_check_packet(struct osdp_pd *pd)
672
682
  }
673
683
 
674
684
  if (!zero_copy) {
685
+ /*
686
+ * Guard the unsigned subtraction below: if we ever hold more
687
+ * bytes than the header declared, the wrap-around would ask for
688
+ * a huge (negative when cast to int) count and wedge the framer.
689
+ * Treat it as a malformed frame so the link resets and recovers.
690
+ */
691
+ if (pd->packet_buf_len > pd->packet_len) {
692
+ LOG_ERR("Buffered %lu bytes exceeds packet length %lu",
693
+ pd->packet_buf_len, pd->packet_len);
694
+ return OSDP_ERR_PKT_FMT;
695
+ }
675
696
  /* Traditional: collect remaining packet bytes from ring buffer */
676
697
  ret = osdp_rb_pop_buf(pd->rx.rb,
677
698
  pd->packet_buf + pd->packet_buf_len,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes