We assume /proc/cmdline will be no more than 512 bytes (including NUL).
It can actually be 4096 bytes (excluding NUL).
This commit makes sure we allocate enough space for it and its NUL.
#include "ply-progress.h"
#ifndef PLY_MAX_COMMAND_LINE_SIZE
-#define PLY_MAX_COMMAND_LINE_SIZE 512
+#define PLY_MAX_COMMAND_LINE_SIZE 4097
#endif
#define BOOT_DURATION_FILE PLYMOUTH_TIME_DIRECTORY "/boot-duration"
}
ply_trace ("reading kernel command line");
- if (read (fd, state->kernel_command_line, sizeof(state->kernel_command_line)) < 0) {
+ if (read (fd, state->kernel_command_line, sizeof(state->kernel_command_line) - 1) < 0) {
ply_trace ("couldn't read it: %m");
close (fd);
return false;