Skip to content

Commit 5517191

Browse files
authored
kernel: Remove strncpy() from the kernel (tiann#3529)
torvalds/linux@079a028
1 parent 6c97d1d commit 5517191

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

kernel/manager/apk_sign.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ int get_pkg_from_apk_path(char *pkg, const char *path)
336336
return -1;
337337

338338
// Copying the package name
339-
strncpy(pkg, second_last_slash + 1, pkg_len);
339+
memcpy(pkg, second_last_slash + 1, pkg_len);
340340
pkg[pkg_len] = '\0';
341341

342342
return 0;

kernel/manager/throne_tracker.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ void track_throne(bool prune_only)
294294
break;
295295
}
296296
data->uid = res;
297-
strncpy(data->package, package, KSU_MAX_PACKAGE_NAME);
297+
strscpy(data->package, package, sizeof(data->package));
298298
list_add_tail(&data->list, &uid_list);
299299
// reset line start
300300
line_start = pos;

0 commit comments

Comments
 (0)