diff options
author | Jaeyoon Jung <jaeyoon.jung@lge.com> | 2024-08-27 01:41:34 +0900 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-08-28 09:14:26 +0100 |
commit | c635f6412e1b6e2e4f17ec35c0e2a93728179daf (patch) | |
tree | 5035ea8690cadb5617456fbb58d405705ee26e2b | |
parent | 497c4e87cd361dcf91badf98c892881fd7284d52 (diff) | |
download | poky-c635f6412e1b6e2e4f17ec35c0e2a93728179daf.tar.gz |
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>
-rw-r--r-- | meta/recipes-devtools/makedevs/makedevs/makedevs.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/meta/recipes-devtools/makedevs/makedevs/makedevs.c b/meta/recipes-devtools/makedevs/makedevs/makedevs.c index 2254b54891..411a669153 100644 --- a/meta/recipes-devtools/makedevs/makedevs/makedevs.c +++ b/meta/recipes-devtools/makedevs/makedevs/makedevs.c | |||
@@ -202,7 +202,7 @@ static unsigned long convert2guid(char *id_buf, struct name_id *search_list) | |||
202 | // Check for bad user/group name | 202 | // Check for bad user/group name |
203 | node = search_list; | 203 | node = search_list; |
204 | while (node != NULL) { | 204 | while (node != NULL) { |
205 | if (!strncmp(node->name, id_buf, strlen(id_buf))) { | 205 | if (!strncmp(node->name, id_buf, MAX_ID_LEN)) { |
206 | fprintf(stderr, "WARNING: Bad user/group name %s detected\n", id_buf); | 206 | fprintf(stderr, "WARNING: Bad user/group name %s detected\n", id_buf); |
207 | break; | 207 | break; |
208 | } | 208 | } |
@@ -212,7 +212,7 @@ static unsigned long convert2guid(char *id_buf, struct name_id *search_list) | |||
212 | } else { | 212 | } else { |
213 | node = search_list; | 213 | node = search_list; |
214 | while (node != NULL) { | 214 | while (node != NULL) { |
215 | if (!strncmp(node->name, id_buf, strlen(id_buf))) | 215 | if (!strncmp(node->name, id_buf, MAX_ID_LEN)) |
216 | return node->id; | 216 | return node->id; |
217 | node = node->next; | 217 | node = node->next; |
218 | } | 218 | } |
@@ -362,13 +362,13 @@ static void add_new_fifo(char *name, char *path, unsigned long uid, | |||
362 | static int interpret_table_entry(char *line) | 362 | static int interpret_table_entry(char *line) |
363 | { | 363 | { |
364 | char *name; | 364 | char *name; |
365 | char usr_buf[MAX_ID_LEN]; | 365 | char usr_buf[MAX_ID_LEN+1]; |
366 | char grp_buf[MAX_ID_LEN]; | 366 | char grp_buf[MAX_ID_LEN+1]; |
367 | char path[4096], type; | 367 | char path[PATH_MAX], type; |
368 | unsigned long mode = 0755, uid = 0, gid = 0, major = 0, minor = 0; | 368 | unsigned long mode = 0755, uid = 0, gid = 0, major = 0, minor = 0; |
369 | unsigned long start = 0, increment = 1, count = 0; | 369 | unsigned long start = 0, increment = 1, count = 0; |
370 | 370 | ||
371 | if (0 > sscanf(line, "%4095s %c %lo %39s %39s %lu %lu %lu %lu %lu", path, | 371 | if (0 > sscanf(line, "%4095s %c %lo %40s %40s %lu %lu %lu %lu %lu", path, |
372 | &type, &mode, usr_buf, grp_buf, &major, &minor, &start, | 372 | &type, &mode, usr_buf, grp_buf, &major, &minor, &start, |
373 | &increment, &count)) | 373 | &increment, &count)) |
374 | { | 374 | { |