diff options
| author | Jaeyoon Jung <jaeyoon.jung@lge.com> | 2024-08-27 01:41:34 +0900 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2024-10-18 06:04:41 -0700 |
| commit | 008e269c6b7f84a7b925e60a7b0cb0d851f70e17 (patch) | |
| tree | 7aad9b089a38f20970f7e0ecb5a3a10f6d847df1 /meta | |
| parent | 9d9325d07b7b94439332342a2058130bcd20a2b3 (diff) | |
| download | poky-008e269c6b7f84a7b925e60a7b0cb0d851f70e17.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: 865b7149da5dd6301c1d9805a1e7bac8dcac82a9)
Signed-off-by: Jaeyoon Jung <jaeyoon.jung@lge.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit ca9d193a21e6b8669c4da1a68cd5e0791bb80a4b)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta')
| -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 | { |
