set_part_name_chomp: fix potential off-by-one in set_part_name_chomp()
This commit is contained in:
parent
407520464f
commit
f9abcbb71b
1 changed files with 1 additions and 1 deletions
|
@ -196,7 +196,7 @@ void set_part_name(partition_t *partition,const char *src,const int max_size)
|
||||||
void set_part_name_chomp(partition_t *partition, const unsigned char *src, const int max_size)
|
void set_part_name_chomp(partition_t *partition, const unsigned char *src, const int max_size)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<sizeof(partition->fsname) && i<max_size && src[i]!='\0'; i++)
|
for(i=0; i<sizeof(partition->fsname)-1 && i<max_size && src[i]!='\0'; i++)
|
||||||
partition->fsname[i]=src[i];
|
partition->fsname[i]=src[i];
|
||||||
partition->fsname[i]='\0';
|
partition->fsname[i]='\0';
|
||||||
for(i--; i>=0 && src[i]==' '; i--);
|
for(i--; i>=0 && src[i]==' '; i--);
|
||||||
|
|
Loading…
Reference in a new issue