1
0
mirror of https://github.com/anestisb/android-unpackbootimg.git synced 2024-05-16 09:49:30 +00:00

Fix build error due to strncpy bounds

This error is fatal with recent GCC versions:
mkbootimg.c:380:9: error: ‘strncpy’ specified bound 1024 equals destination size
This commit is contained in:
Marti Raudsepp 2018-07-28 18:08:08 +03:00
parent 0809132f6b
commit 36dd263adf

View File

@ -377,7 +377,8 @@ int main(int argc, char **argv)
hdr.cmdline[BOOT_ARGS_SIZE - 1] = '\0';
if (cmdlen >= (BOOT_ARGS_SIZE - 1)) {
cmdline += (BOOT_ARGS_SIZE - 1);
strncpy((char *)hdr.extra_cmdline, cmdline, BOOT_EXTRA_ARGS_SIZE);
strncpy((char *)hdr.extra_cmdline, cmdline, BOOT_EXTRA_ARGS_SIZE - 1);
hdr.extra_cmdline[BOOT_EXTRA_ARGS_SIZE - 1] = '\0';
}
kernel_data = load_file(kernel_fn, &hdr.kernel_size);