device_parser: Increase max key/value length

When pointing alpaca to persistent named aliases in /dev/serial/by-id we
end up with > 80 chars of path in value, which gets nicely truncated.
Increase this max.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
Bjorn Andersson
2018-12-05 11:43:14 -08:00
parent 07b7d195fc
commit 5da489beee

View File

@@ -37,6 +37,8 @@
#include "cdb_assist.h"
#include "conmux.h"
#define TOKEN_LENGTH 256
struct device_parser {
yaml_parser_t parser;
yaml_event_t event;
@@ -54,8 +56,8 @@ static int accept(struct device_parser *dp, int type, char *scalar)
{
if (dp->event.type == type) {
if (scalar) {
strncpy(scalar, (char *)dp->event.data.scalar.value, 79);
scalar[79] = '\0';
strncpy(scalar, (char *)dp->event.data.scalar.value, TOKEN_LENGTH - 1);
scalar[TOKEN_LENGTH - 1] = '\0';
}
yaml_event_delete(&dp->event);
@@ -79,8 +81,8 @@ static bool expect(struct device_parser *dp, int type, char *scalar)
static void parse_board(struct device_parser *dp)
{
struct device *dev;
char value[80];
char key[80];
char value[TOKEN_LENGTH];
char key[TOKEN_LENGTH];
dev = calloc(1, sizeof(*dev));