Merge pull request #162 from linD026/master

Fix the buffer length may cause a read error
This commit is contained in:
Jim Huang 2022-09-08 12:19:42 +08:00 committed by GitHub
commit d79fdc8559
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -36,7 +36,7 @@ enum {
/* Is device open? Used to prevent multiple access to device */
static atomic_t already_open = ATOMIC_INIT(CDEV_NOT_USED);
static char msg[BUF_LEN]; /* The msg the device will give when asked */
static char msg[BUF_LEN + 1]; /* The msg the device will give when asked */
static struct class *cls;

View File

@ -28,7 +28,7 @@ enum {
static atomic_t already_open = ATOMIC_INIT(CDEV_NOT_USED);
/* The message the device will give when asked */
static char message[BUF_LEN];
static char message[BUF_LEN + 1];
static struct class *cls;