From 2271f47026e986ecd038db8fbf7a1d14c11a7b64 Mon Sep 17 00:00:00 2001 From: Adrian Hunter Date: Fri, 16 Mar 2007 18:07:43 +0200 Subject: UBI-Utils: Updated libubi for latest UBI Signed-off-by: Adrian Hunter --- ubi-utils/src/libubi.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ubi-utils/src/libubi.c b/ubi-utils/src/libubi.c index 62216ad..da4919b 100644 --- a/ubi-utils/src/libubi.c +++ b/ubi-utils/src/libubi.c @@ -311,7 +311,7 @@ ubi_open(ubi_lib_t *desc) if (err) goto error; - res->vdev_path = mkpath(res->udev_path, "%d/"); + res->vdev_path = mkpath(res->ubi_root, "ubi%d_%d/"); if (!res->vdev_path) goto error; @@ -595,6 +595,11 @@ ubi_mkvol(ubi_lib_t desc, int devn, int vol_id, int vol_type, int fd; int err; struct ubi_mkvol_req req; + size_t n; + + n = strlen(name); + if (n > UBI_MAX_VOLUME_NAME) + return -1; if ((fd = ubi_cdev_open(desc, devn, O_RDWR)) == -1) return -1; @@ -603,8 +608,9 @@ ubi_mkvol(ubi_lib_t desc, int devn, int vol_id, int vol_type, req.bytes = bytes; req.vol_type = vol_type; req.alignment = alignment; - req.name_len = strlen(name); - req.name = name; + + strncpy(req.name, name, UBI_MAX_VOLUME_NAME + 1); + req.name_len = n; /* printf("DBG: %s(vol_id=%d, bytes=%lld, type=%d, alig=%d, nlen=%d, " "name=%s)\n", __func__, vol_id, bytes, vol_type, alignment, -- cgit v1.2.3