mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 13:29:49 +00:00
makedevs: Fix matching uid/gid
Correct the length to compare in convert2guid() to fix an issue where it ends up with returning a wrong id that matches partially. Also fix the length of usr_buf and grp_buf in interpret_table_entry() which are used as arguments of convert2guid(). (From OE-Core rev: ca9d193a21e6b8669c4da1a68cd5e0791bb80a4b) Signed-off-by: Jaeyoon Jung <jaeyoon.jung@lge.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
497c4e87cd
commit
c635f6412e
@@ -202,7 +202,7 @@ static unsigned long convert2guid(char *id_buf, struct name_id *search_list)
|
|||||||
// Check for bad user/group name
|
// Check for bad user/group name
|
||||||
node = search_list;
|
node = search_list;
|
||||||
while (node != NULL) {
|
while (node != NULL) {
|
||||||
if (!strncmp(node->name, id_buf, strlen(id_buf))) {
|
if (!strncmp(node->name, id_buf, MAX_ID_LEN)) {
|
||||||
fprintf(stderr, "WARNING: Bad user/group name %s detected\n", id_buf);
|
fprintf(stderr, "WARNING: Bad user/group name %s detected\n", id_buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ static unsigned long convert2guid(char *id_buf, struct name_id *search_list)
|
|||||||
} else {
|
} else {
|
||||||
node = search_list;
|
node = search_list;
|
||||||
while (node != NULL) {
|
while (node != NULL) {
|
||||||
if (!strncmp(node->name, id_buf, strlen(id_buf)))
|
if (!strncmp(node->name, id_buf, MAX_ID_LEN))
|
||||||
return node->id;
|
return node->id;
|
||||||
node = node->next;
|
node = node->next;
|
||||||
}
|
}
|
||||||
@@ -362,13 +362,13 @@ static void add_new_fifo(char *name, char *path, unsigned long uid,
|
|||||||
static int interpret_table_entry(char *line)
|
static int interpret_table_entry(char *line)
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
char usr_buf[MAX_ID_LEN];
|
char usr_buf[MAX_ID_LEN+1];
|
||||||
char grp_buf[MAX_ID_LEN];
|
char grp_buf[MAX_ID_LEN+1];
|
||||||
char path[4096], type;
|
char path[PATH_MAX], type;
|
||||||
unsigned long mode = 0755, uid = 0, gid = 0, major = 0, minor = 0;
|
unsigned long mode = 0755, uid = 0, gid = 0, major = 0, minor = 0;
|
||||||
unsigned long start = 0, increment = 1, count = 0;
|
unsigned long start = 0, increment = 1, count = 0;
|
||||||
|
|
||||||
if (0 > sscanf(line, "%4095s %c %lo %39s %39s %lu %lu %lu %lu %lu", path,
|
if (0 > sscanf(line, "%4095s %c %lo %40s %40s %lu %lu %lu %lu %lu", path,
|
||||||
&type, &mode, usr_buf, grp_buf, &major, &minor, &start,
|
&type, &mode, usr_buf, grp_buf, &major, &minor, &start,
|
||||||
&increment, &count))
|
&increment, &count))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user