#include <libsigrok/libsigrok.h>
#include "libsigrok-internal.h"
-SR_PRIV int bv_get_value(float *out, const struct binary_value_spec *spec,
+SR_PRIV int bv_get_value_len(float *out, const struct binary_value_spec *spec,
const uint8_t *data, size_t length)
{
float value;
std_session_send_df_frame_begin(sdi);
for (ch_idx = 0; ch_idx < devc->channel_count; ch_idx++) {
pch = &devc->channels[ch_idx];
- ret = bv_get_value(&v, &pch->spec, poll_pkt, TC_POLL_LEN);
+ ret = bv_get_value_len(&v, &pch->spec, poll_pkt, TC_POLL_LEN);
if (ret != SR_OK)
break;
ret = feed_queue_analog_submit(devc->feeds[ch_idx], v, 1);
ret = SR_OK;
std_session_send_df_frame_begin(sdi);
for (ch_idx = 0; ch_idx < p->channel_count; ch_idx++) {
- ret = bv_get_value(&v, &p->channels[ch_idx].spec, data, dlen);
+ ret = bv_get_value_len(&v, &p->channels[ch_idx].spec, data, dlen);
if (ret != SR_OK)
break;
ret = feed_queue_analog_submit(devc->feeds[ch_idx], v, 1);
};
/**
- * Read extract a value from a binary data image.
+ * Read extract a value from a binary data image, ensuring no out-of-bounds
+ * read happens.
*
* @param[out] out Pointer to output buffer (conversion result)
* @param[in] spec Binary value specification
*
* @return SR_OK on success, SR_ERR_* error code on failure.
*/
-SR_PRIV int bv_get_value(float *out, const struct binary_value_spec *spec,
+SR_PRIV int bv_get_value_len(float *out, const struct binary_value_spec *spec,
const uint8_t *data, size_t length);
/*--- crc.c -----------------------------------------------------------------*/