Blob Blame History Raw
From 0610dc493702929f8376687249b5ba98180198f3 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Mon, 22 Jan 2024 10:40:42 +1000
Subject: [PATCH 1/3] props: fix the max lengths for
 set_name/description/short_description

All three had the wrong copy/pasta applied to them, so if this function
was ever called, our description was limited to e.g. 32 bytes.
I'm assuming this function has never been used before.
---
 libxklavier/xklavier_props.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libxklavier/xklavier_props.c b/libxklavier/xklavier_props.c
index 95f38e2..73996d6 100644
--- a/libxklavier/xklavier_props.c
+++ b/libxklavier/xklavier_props.c
@@ -65,7 +65,7 @@ xkl_config_item_set_name(XklConfigItem * item,
 			 const gchar * name)
 {
 	if (name != NULL)
-		strncpy (item->name, name, XKL_MAX_CI_SHORT_DESC_LENGTH-1);
+		strncpy (item->name, name, XKL_MAX_CI_NAME_LENGTH-1);
 	else
 		item->name[0] = '\0';
 }
@@ -81,7 +81,7 @@ xkl_config_item_set_short_description(XklConfigItem * item,
 				      const gchar * short_description)
 {
 	if (short_description != NULL)
-		strncpy (item->short_description, short_description, XKL_MAX_CI_DESC_LENGTH-1);
+		strncpy (item->short_description, short_description, XKL_MAX_CI_SHORT_DESC_LENGTH-1);
 	else
 		item->short_description[0] = '\0';
 }
@@ -97,7 +97,7 @@ xkl_config_item_set_description(XklConfigItem * item,
 				const gchar * description)
 {
 	if (description != NULL)
-		strncpy (item->description, description, XKL_MAX_CI_NAME_LENGTH-1);
+		strncpy (item->description, description, XKL_MAX_CI_DESC_LENGTH-1);
 	else
 		item->description[0] = '\0';
 }
-- 
2.43.0