Skip to content

Commit

Permalink
kernel: use strncpy and strncmp
Browse files Browse the repository at this point in the history
  • Loading branch information
tiann committed Oct 12, 2023
1 parent b183004 commit 3408f94
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/uid_observer.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static bool is_uid_exist(uid_t uid, char *package, void *data)
bool exist = false;
list_for_each_entry (np, list, list) {
if (np->uid == uid % 100000 &&
strcmp(np->package, package) == 0) {
strncmp(np->package, package, KSU_MAX_PACKAGE_NAME) == 0) {
exist = true;
break;
}
Expand Down Expand Up @@ -89,7 +89,7 @@ static void do_update_uid(struct work_struct *work)
continue;
}
data->uid = res;
strcpy(data->package, package);
strncpy(data->package, package, KSU_MAX_PACKAGE_NAME);
list_add_tail(&data->list, &uid_list);
// reset line start
line_start = pos;
Expand Down

0 comments on commit 3408f94

Please sign in to comment.