From 5d955d55c8736a1e7494c9021f7b4cbf316cfc3e Mon Sep 17 00:00:00 2001 From: Jesse Smith Date: Sat, 29 Dec 2018 14:46:10 -0400 Subject: [PATCH] Increased the size of the kernel command line buffer in bootlogd from 256 characters to 4096. This size is defined in KERNEL_COMMAND_LENGTH for easy modification downstream. --- doc/Changelog | 4 ++++ src/bootlogd.c | 8 +++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index 8008200..ba64343 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -15,6 +15,10 @@ sysvinit (2.94) unreleased; urgency=low and freeing is now handled in stdlib.h * Added defines for FreeBSD to make some components compile on FreeBSD 11. + * Increased the size of the kernel command line buffer in bootlogd + from 256 characters to 4096. This size is defined in KERNEL_COMMAND_LENGTH + for easy modification downstream. + sysvinit (2.93) released; urgency=low diff --git a/src/bootlogd.c b/src/bootlogd.c index bf3983c..66057ee 100644 --- a/src/bootlogd.c +++ b/src/bootlogd.c @@ -63,6 +63,7 @@ #include "bootlogd.h" #define MAX_CONSOLES 16 +#define KERNEL_COMMAND_LENGTH 4096 char ringbuf[32768]; char *endptr = ringbuf + sizeof(ringbuf); @@ -257,7 +258,7 @@ int consolenames(struct real_cons *cons, int max_consoles) /* This appears to be unused. unsigned int kdev; */ #endif struct stat st, st2; - char buf[256]; + char buf[KERNEL_COMMAND_LENGTH]; char *p; int didmount = 0; int n; @@ -286,17 +287,14 @@ int consolenames(struct real_cons *cons, int max_consoles) perror("bootlogd: /proc/cmdline"); } else { buf[0] = 0; - if ((n = read(fd, buf, sizeof(buf) - 1)) < 0) + if ((n = read(fd, buf, KERNEL_COMMAND_LENGTH - 1)) < 0) perror("bootlogd: /proc/cmdline"); close(fd); } if (didmount) umount("/proc"); - if (n < 0) return 0; - - /* * OK, so find console= in /proc/cmdline. * Parse in reverse, opening as we go.