From 63cb32a6e88861b7deded0dd14c2298b9015202a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 28 Jul 2026 08:52:38 +0200 Subject: [PATCH 1/3] Apply suggested fix to gammu/src/convertors/sms.c from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- gammu/src/convertors/sms.c | 1 - 1 file changed, 1 deletion(-) diff --git a/gammu/src/convertors/sms.c b/gammu/src/convertors/sms.c index df3cb1df7..cc944471f 100644 --- a/gammu/src/convertors/sms.c +++ b/gammu/src/convertors/sms.c @@ -498,7 +498,6 @@ char *UDHTypeToString(GSM_UDH type) if (s == NULL) { PyErr_Format(PyExc_ValueError, "Bad value for UDHType from Gammu: '%d'", type); - free(s); return NULL; } From cc247c6bab2f7b39bbd6291657cc09c084a865d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 28 Jul 2026 08:52:38 +0200 Subject: [PATCH 2/3] Apply suggested fix to gammu/src/convertors/sms.c from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- gammu/src/convertors/sms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gammu/src/convertors/sms.c b/gammu/src/convertors/sms.c index cc944471f..e8ba66feb 100644 --- a/gammu/src/convertors/sms.c +++ b/gammu/src/convertors/sms.c @@ -214,7 +214,7 @@ GSM_SMSFormat StringToSMSFormat(char *s) else if (strcmp("Email", s) == 0) return SMS_FORMAT_Email; else { - PyErr_Format(PyExc_MemoryError, "Bad value for SMS Format '%s'", + PyErr_Format(PyExc_ValueError, "Bad value for SMS Format '%s'", s); return 0; } From 89f048c20b26975bae67d28fc8d7b76f23468f09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 28 Jul 2026 08:52:39 +0200 Subject: [PATCH 3/3] Apply suggested fix to gammu/src/convertors/sms.c from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- gammu/src/convertors/sms.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gammu/src/convertors/sms.c b/gammu/src/convertors/sms.c index e8ba66feb..0a5980f4c 100644 --- a/gammu/src/convertors/sms.c +++ b/gammu/src/convertors/sms.c @@ -49,16 +49,16 @@ char *SMSValidityToString(GSM_SMSValidity Validity) if (Validity.Relative == SMS_VALID_Max_Time) { strcpy(s, "Max"); } else if (Validity.Relative <= 143) { - snprintf(s, 99, "%dM", + snprintf(s, sizeof(s) - 1, "%dM", 5 * (1 + Validity.Relative)); } else if (Validity.Relative <= 167) { - snprintf(s, 99, "%dM", + snprintf(s, sizeof(s) - 1, "%dM", 12 * 60 + 30 * (Validity.Relative - 143)); } else if (Validity.Relative <= 196) { - snprintf(s, 99, "%dD", Validity.Relative - 166); + snprintf(s, sizeof(s) - 1, "%dD", Validity.Relative - 166); } else { - snprintf(s, 99, "%dW", Validity.Relative - 192); + snprintf(s, sizeof(s) - 1, "%dW", Validity.Relative - 192); } break; default: