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.
- {libosdp-3.2.3 → libosdp-3.2.5}/PKG-INFO +1 -1
- {libosdp-3.2.3 → libosdp-3.2.5}/libosdp.egg-info/PKG-INFO +1 -1
- {libosdp-3.2.3 → libosdp-3.2.5}/setup.py +1 -1
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_config.h +4 -4
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_cp.c +4 -2
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_file.c +22 -2
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_phy.c +25 -4
- {libosdp-3.2.3 → libosdp-3.2.5}/MANIFEST.in +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/README.md +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/libosdp.egg-info/SOURCES.txt +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/libosdp.egg-info/dependency_links.txt +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/libosdp.egg-info/top_level.txt +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/osdp/__init__.py +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/osdp/channel.py +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/osdp/constants.py +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/osdp/control_panel.py +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/osdp/helpers.py +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/osdp/key_store.py +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/osdp/peripheral_device.py +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/pyproject.toml +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/setup.cfg +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/include/osdp.h +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/include/osdp_export.h +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/python/osdp_sys/base.c +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/python/osdp_sys/cp.c +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/python/osdp_sys/data.c +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/python/osdp_sys/module.c +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/python/osdp_sys/module.h +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/python/osdp_sys/pd.c +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/python/osdp_sys/utils.c +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/crypto/tinyaes.c +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/crypto/tinyaes_src.c +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/crypto/tinyaes_src.h +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_common.c +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_common.h +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_diag.c +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_diag.h +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_file.h +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_pd.c +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/src/osdp_sc.c +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/include/utils/assert.h +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/include/utils/crc16.h +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/include/utils/disjoint_set.h +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/include/utils/list.h +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/include/utils/logger.h +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/include/utils/pcap_gen.h +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/include/utils/queue.h +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/include/utils/slab.h +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/include/utils/utils.h +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/src/crc16.c +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/src/disjoint_set.c +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/src/list.c +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/src/logger.c +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/src/pcap_gen.c +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/src/queue.c +0 -0
- {libosdp-3.2.3 → libosdp-3.2.5}/vendor/utils/src/utils.c +0 -0
|
@@ -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.
|
|
14
|
+
#define PROJECT_VERSION "3.2.5"
|
|
15
15
|
#define PROJECT_NAME "libosdp"
|
|
16
|
-
#define GIT_BRANCH "
|
|
17
|
-
#define GIT_REV "
|
|
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)
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
/*
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
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
|
|
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
|
|
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
|