summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dbi.h6
-rw-r--r--src/json.h5
-rw-r--r--src/rest.c8
3 files changed, 12 insertions, 7 deletions
diff --git a/src/dbi.h b/src/dbi.h
index f6cb1dd..ab393e7 100644
--- a/src/dbi.h
+++ b/src/dbi.h
@@ -27,6 +27,7 @@ void og_dbi_close(struct og_dbi *db);
#define OG_DB_ROOM_LOC_MAXLEN 255
#define OG_DB_SERIAL_NUMBER_MAXLEN 25
#define OG_DB_IMAGE_DESCRIPTION_MAXLEN 250
+#define OG_DB_REPO_NAME_MAXLEN 250
#define OG_DB_PART_NAME_MAXLEN 250
#define OG_DB_IMAGE_NAME_MAXLEN 50
#define OG_DB_FILESYSTEM_MAXLEN 16
@@ -104,6 +105,11 @@ struct og_room {
bool remote;
};
+struct og_repository {
+ char name[OG_DB_REPO_NAME_MAXLEN];
+ char ip[OG_DB_IP_MAXLEN];
+};
+
struct in_addr;
int og_dbi_get_computer_info(struct og_dbi *dbi, struct og_computer *computer,
struct in_addr addr);
diff --git a/src/json.h b/src/json.h
index 9ac5c4e..e37f1b2 100644
--- a/src/json.h
+++ b/src/json.h
@@ -132,9 +132,4 @@ struct og_procedure {
int og_json_parse_procedure(json_t *element, struct og_procedure *proc);
-struct og_repository {
- const char *name;
- const char *ip;
-};
-
#endif
diff --git a/src/rest.c b/src/rest.c
index de2d9ed..ec4ae55 100644
--- a/src/rest.c
+++ b/src/rest.c
@@ -5210,10 +5210,14 @@ static int og_cmd_post_repository_add(json_t *element,
json_object_foreach(element, key, value) {
if (!strcmp(key, "name")) {
- err = og_json_parse_string(value, &repo.name);
+ err = og_json_parse_string_copy(value,
+ repo.name,
+ sizeof(repo.name));
params->flags |= OG_REST_PARAM_NAME;
} else if (!strcmp(key, "ip")) {
- err = og_json_parse_string(value, &repo.ip);
+ err = og_json_parse_string_copy(value,
+ repo.ip,
+ sizeof(repo.ip));
params->flags |= OG_REST_PARAM_ADDR;
}