aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-pdcp-nr.c
diff options
context:
space:
mode:
authorMartin Mathieson <martin.mathieson@keysight.com>2021-02-14 15:00:19 +0000
committerMartin Mathieson <martin.mathieson@keysight.com>2021-02-14 15:00:19 +0000
commite727d6f8385b2ab8c40915cb433531067f9532c5 (patch)
treec1ea8ca5b2afe3f62baaa8dcb523078452f22b36 /epan/dissectors/packet-pdcp-nr.c
parent20bc017ba518d940afc6bb07f5b1ea1062706858 (diff)
PDCP: set key error strings with g_strdup_print)
Diffstat (limited to 'epan/dissectors/packet-pdcp-nr.c')
-rw-r--r--epan/dissectors/packet-pdcp-nr.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/epan/dissectors/packet-pdcp-nr.c b/epan/dissectors/packet-pdcp-nr.c
index 06caf0dba8..e5ef472652 100644
--- a/epan/dissectors/packet-pdcp-nr.c
+++ b/epan/dissectors/packet-pdcp-nr.c
@@ -193,14 +193,11 @@ static gboolean check_valid_key_string(const char* raw_string, char* checked_str
guint written = 0;
guint length = (gint)strlen(raw_string);
- char error_str[256];
-
/* Can't be valid if not long enough. */
if (length < 32) {
if (length > 0) {
- g_snprintf(error_str, 256, "PDCP NR: Invalid key string (%s) - should include 32 ASCII hex characters (16 bytes) but only %u chars given",
- raw_string, length);
- *error = g_strdup(error_str);
+ *error = g_strdup_printf("PDCP NR: Invalid key string (%s) - should include 32 ASCII hex characters (16 bytes) but only %u chars given",
+ raw_string, length);
}
return FALSE;
}
@@ -220,21 +217,18 @@ static gboolean check_valid_key_string(const char* raw_string, char* checked_str
checked_string[written++] = c;
}
else {
- g_snprintf(error_str, 256, "PDCP-NR: Invalid char '%c' given in key", c);
- *error = g_strdup(error_str);
+ *error = g_strdup_printf("PDCP-NR: Invalid char '%c' given in key", c);
return FALSE;
}
}
/* Must have found exactly 32 hex ascii chars for 16-byte key */
if (n<length) {
- g_snprintf(error_str, 256, "PDCP-NR: Key (%s) should contain 32 hex characters (16 bytes) but more detected", raw_string);
- *error = g_strdup(error_str);
+ *error = g_strdup_printf("PDCP-NR: Key (%s) should contain 32 hex characters (16 bytes) but more detected", raw_string);
return FALSE;
}
if (written != 32) {
- g_snprintf(error_str, 256, "PDCP-NR: Key (%s) should contain 32 hex characters (16 bytes) but %u detected", raw_string, written);
- *error = g_strdup(error_str);
+ *error = g_strdup_printf("PDCP-NR: Key (%s) should contain 32 hex characters (16 bytes) but %u detected", raw_string, written);
return FALSE;
}
else {