[Olsr-dev] [PATCH] Fix printf based warning in PUD

Henning Rogge (spam-protected)
Fri May 25 07:12:57 CEST 2012


My compiler at work is even a little bit older. Maybe this version 
always activates the corresponding warning which checks the printf() 
parameter?

gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.

Henning Rogge

On 05/24/2012 07:50 PM, Henning Rogge wrote:
> Let me check my compiler at work tomorrow... I found the bug there.
>
> Henning
>
> On Thu, May 24, 2012 at 7:48 PM, Ferry Huberts<(spam-protected)>  wrote:
>>
>>
>> On 24-05-12 19:38, Henning Rogge wrote:
>>>
>>> Same for me... strange.
>>>
>>> (spam-protected):~$ gcc --version
>>> gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
>>> Copyright (C) 2011 Free Software Foundation, Inc.
>>> This is free software; see the source for copying conditions.  There is NO
>>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
>>> PURPOSE.
>>>
>>
>> this one also didn't catch it:
>>
>> gcc --version
>> gcc (Debian 4.4.5-8) 4.4.5
>> Copyright (C) 2010 Free Software Foundation, Inc.
>>
>> This is free software; see the source for copying conditions.  There is NO
>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>>
>>
>> will file a bug in fedora
>>
>> I find this very strange since I've clearly annotated the function with a
>> format attribute. sigh.
>>
>>
>>
>>
>>> Henning
>>>
>>> On Thu, May 24, 2012 at 7:34 PM, Ferry Huberts<(spam-protected)>    wrote:
>>>>
>>>>
>>>>
>>>> On 24-05-12 19:33, Henning Rogge wrote:
>>>>>
>>>>>
>>>>> Which gcc version are you using?
>>>>
>>>>
>>>>
>>>> $ gcc --version
>>>> gcc (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2)
>>>> Copyright (C) 2011 Free Software Foundation, Inc.
>>>> This is free software; see the source for copying conditions.  There is
>>>> NO
>>>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
>>>> PURPOSE.
>>>>
>>>>
>>>>>
>>>>> Henning
>>>>>
>>>>> On Thu, May 24, 2012 at 4:04 PM, Ferry Huberts<(spam-protected)>
>>>>>   wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 24-05-12 15:59, Henning Rogge wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>   From 21a4b73a4a2c67e458f6865e91b6f20c8de963a4 Mon Sep 17 00:00:00
>>>>>>> 2001
>>>>>>> From: Henning Rogge<(spam-protected)>
>>>>>>> Date: Thu, 24 May 2012 15:56:48 +0200
>>>>>>> Subject: [PATCH] Fix printf based warning in PUD
>>>>>>>
>>>>>>>
>>>>>>> Signed-off-by: Henning Rogge<(spam-protected)>
>>>>>>> ---
>>>>>>> lib/pud/src/configuration.c | 4 ++--
>>>>>>> 1 files changed, 2 insertions(+), 2 deletions(-)
>>>>>>>
>>>>>>> diff --git a/lib/pud/src/configuration.c b/lib/pud/src/configuration.c
>>>>>>> index 286768c..2be36be 100644
>>>>>>> --- a/lib/pud/src/configuration.c
>>>>>>> +++ b/lib/pud/src/configuration.c
>>>>>>> @@ -344,7 +344,7 @@ static bool intSetupNodeIdBinaryString(void) {
>>>>>>> invalidChars = nmea_string_has_invalid_chars(nodeid,
>>>>>>> PUD_NODE_ID_NAME,&report[0], sizeof(report));
>>>>>>> if (invalidChars) {
>>>>>>> - pudError(false,&report[0]);
>>>>>>> + pudError(false, "%s",&report[0]);
>>>>>>>
>>>>>>> return false;
>>>>>>> }
>>>>>>>
>>>>>>> @@ -1345,7 +1345,7 @@ int setTxNmeaMessagePrefix(const char *value,
>>>>>>> void
>>>>>>> *data __attribute__ ((unused)
>>>>>>> invalidChars = nmea_string_has_invalid_chars(value,
>>>>>>> valueName,&report[0],
>>>>>>> sizeof(report));
>>>>>>> if (invalidChars) {
>>>>>>> - pudError(false,&report[0]);
>>>>>>> + pudError(false, "%s",&report[0]);
>>>>>>> return true;
>>>>>>> }
>>>>>>>
>>>>>>
>>>>>> Reviewed-by: Ferry Huberts<(spam-protected)>
>>>>>>
>>>>>>
>>>>>> strange that my compiler didn't catch this...
>>>>>> --
>>>>>> Ferry Huberts
>>>>>>
>>>>>> --
>>>>>> Olsr-dev mailing list
>>>>>> (spam-protected)
>>>>>> https://lists.olsr.org/mailman/listinfo/olsr-dev
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> Ferry Huberts
>>>
>>>
>>>
>>>
>>
>> --
>> Ferry Huberts
>
>
>


-- 
Diplom-Informatiker Henning Rogge , Fraunhofer-Institut für
Kommunikation, Informationsverarbeitung und Ergonomie FKIE
Kommunikationssysteme (KOM)
Neuenahrer Straße 20, 53343 Wachtberg, Germany
Telefon +49 228 9435-961,   Fax +49 228 9435 685
mailto:(spam-protected) http://www.fkie.fraunhofer.de
GPG: E1C6 0914 490B 3909 D944 F80D 4487 C67C 55EC CFE0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6156 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20120525/b6121063/attachment.bin>


More information about the Olsr-dev mailing list