gnokii-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-44


From: Daniele Forsi
Subject: [SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-441-g71e212a
Date: Tue, 05 Mar 2013 09:44:59 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "libgnokii and core programs".

The branch, master has been updated
       via  71e212a40a9b17072fcec721406df8bc3188ec8f (commit)
      from  31c926e8fe862d2f8e33b353b436b103fc73ac85 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/gnokii.git/commit/?id=71e212a40a9b17072fcec721406df8bc3188ec8f


commit 71e212a40a9b17072fcec721406df8bc3188ec8f
Author: Daniele Forsi <address@hidden>
Date:   Tue Mar 5 10:23:57 2013 +0100

    Fix false positive detection of buffer overflow in BCD date decoding
    
    Buffer can't overflow because each BCD digit is masked with 0x0f and
    snprintf() uses %02d but usage of strncat() was indeed wrong.
    From man strncat: If src contains n or more bytes, strncat() writes
    n+1 bytes to dest (n from src plus the terminating null byte).
    Bug and fix by clang:
    
http://clang.debian.net/logs/2013-01-28/gnokii_0.6.30+dfsg-1_unstable_clang.log

diff --git a/common/gsm-sms.c b/common/gsm-sms.c
index fa54a92..f2bb91c 100644
--- a/common/gsm-sms.c
+++ b/common/gsm-sms.c
@@ -152,7 +152,7 @@ static char *sms_timestamp_print(u8 *number)
                        break;
                }
                snprintf(buf2, 4, "%d%d%c", number[i] & 0x0f, number[i] >> 4, 
c);
-               strncat(buffer, buf2, sizeof(buffer) - strlen(buffer));
+               strncat(buffer, buf2, sizeof(buffer) - strlen(buffer) - 1);
        }
 
        /* The GSM spec is not clear what is the sign of the timezone when the
@@ -161,12 +161,12 @@ static char *sms_timestamp_print(u8 *number)
         * sign disturbs you, change the sign here.
         */
        if (number[6] & 0x08)
-               strncat(buffer, "-", sizeof(buffer) - strlen(buffer));
+               strncat(buffer, "-", sizeof(buffer) - strlen(buffer) - 1);
        else
-               strncat(buffer, "+", sizeof(buffer) - strlen(buffer));
+               strncat(buffer, "+", sizeof(buffer) - strlen(buffer) - 1);
        /* The timezone is given in quarters. The base is GMT. */
        snprintf(buf, sizeof(buf), "%02d00", (10 * (number[6] & 0x07) + 
(number[6] >> 4)) / 4);
-       strncat(buffer, buf, sizeof(buffer) - strlen(buffer));
+       strncat(buffer, buf, sizeof(buffer) - strlen(buffer) - 1);
 
        return buffer;
 #undef LOCAL_DATETIME_MAX_LENGTH

-----------------------------------------------------------------------

Summary of changes:
 common/gsm-sms.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
libgnokii and core programs



reply via email to

[Prev in Thread] Current Thread [Next in Thread]