From b593442a31ffa02d07727f0b6c767f5451f7b428 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Tue, 30 May 2006 16:20:58 +0000 Subject: [PATCH] Do note limite device name to 16 characters --- libemile/emile_map_bootblock_read.c | 2 +- libemile/emile_map_bootblock_write.c | 2 +- libemile/emile_map_open.c | 3 ++- libemile/partition.h | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libemile/emile_map_bootblock_read.c b/libemile/emile_map_bootblock_read.c index f6cced3..5e7623c 100644 --- a/libemile/emile_map_bootblock_read.c +++ b/libemile/emile_map_bootblock_read.c @@ -16,7 +16,7 @@ static __attribute__((used)) char* rcsid = "$CVSHeader$"; int emile_map_bootblock_read(emile_map_t* map, char* bootblock) { - char name[16]; + char name[MAP_NAME_LEN]; int ret; int fd; diff --git a/libemile/emile_map_bootblock_write.c b/libemile/emile_map_bootblock_write.c index 711bf18..ea99fec 100644 --- a/libemile/emile_map_bootblock_write.c +++ b/libemile/emile_map_bootblock_write.c @@ -16,7 +16,7 @@ static __attribute__((used)) char* rcsid = "$CVSHeader$"; int emile_map_bootblock_write(emile_map_t* map, char* bootblock) { - char name[16]; + char name[MAP_NAME_LEN]; int ret; int fd; diff --git a/libemile/emile_map_open.c b/libemile/emile_map_open.c index 60721fe..6153dde 100644 --- a/libemile/emile_map_open.c +++ b/libemile/emile_map_open.c @@ -35,7 +35,8 @@ emile_map_t* emile_map_open(char *dev, int flags) free(map); return NULL; } - strncpy(map->name, dev, 16); + strncpy(map->name, dev, MAP_NAME_LEN); + map->name[MAP_NAME_LEN - 1] = 0; ret = read(map->fd, &map->drivers, sizeof(map->drivers)); if (ret == -1) diff --git a/libemile/partition.h b/libemile/partition.h index 95a0427..e07c357 100644 --- a/libemile/partition.h +++ b/libemile/partition.h @@ -91,9 +91,10 @@ struct Partition { #define APPLE_VOID "Apple_Void" #define APPLE_PATCHES "Apple_Patches" +#define MAP_NAME_LEN 256 typedef struct { int fd; - char name[16]; + char name[MAP_NAME_LEN]; int current; struct DriverDescriptor drivers; struct Partition partition;