+#include <assert.h>
#include <string.h>
#include <stdint.h>
#include <asm/byteorder.h>
* @param[out] str Pointer to resuling string
* @return zero on success, non-zero on failure
*/
-static int read_string(void *ctx, char **pos, int *len, char **str)
+static int read_string(void *ctx, char **pos, unsigned int *len, char **str)
{
uint32_t str_len, read_len;
struct pb_protocol_message *message)
{
char *buf, *str;
- int len;
+ unsigned int len;
len = message->payload_len;
buf = message->payload;
pos += pb_protocol_serialise_string(pos, opt->boot_args);
}
+ assert(pos <= buf + buf_len);
+
return 0;
}
struct pb_protocol_message *pb_protocol_read_message(void *ctx, int fd)
{
struct pb_protocol_message *message, m;
- int rc, len;
+ int rc;
+ unsigned int len;
/* use the stack for the initial 8-byte read */
{
struct device *dev;
char *pos;
- int i, n_options, len;
+ int i, n_options;
+ unsigned int len;
len = message->payload_len;
pos = message->payload;