Do note limite device name to 16 characters

This commit is contained in:
Laurent Vivier 2006-05-30 16:20:58 +00:00
parent e23b98e394
commit b593442a31
4 changed files with 6 additions and 4 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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;