snprintf() doesn't use format size specifiers

Duss Pirmin pirmin at ...321...
Tue Apr 21 19:39:54 CEST 2015


Hello Norman,

Quoting Norman Feske <norman.feske at ...1...>:

> Hello Pirmin,
>
>>> If I do want to right align the numbers (%-5d) the function crashes my
>>> program.
>>
>> This should not happen. Thank you for reporting. I just opened an issue
>> about it:
>>
>>   https://github.com/genodelabs/genode/issues/1485
>
> unfortunately, I am not able to reproduce the problem. When modifying
> the printf test using the attached patch, the program runs just fine.
>
> Could you share a small test program that triggers the problem? That
> would be greatly appreciated.

I can share the code, where I had the problem, but it is not what I  
would call a small example, but it's also not that big.

It is in an older version of my TraceTool.

https://github.com/trimpim/TraceTool/blob/2f282a9bda1c32ed21019e1218ea6e3226d04064/src/TraceTool/SubjectList.cpp

In the method SubjectList::toString() the data from the list of  
subjects is stored in to a string buffer, that is later sent to a  
terminal session.

I'm currently updating the coding style of the whole code to match the  
Genode coding standard, and fix some big bugs.

As I think a full c++ string implementation is too mouch for my small  
problem, I have written a small string builder class, that stores the  
data in a Genode::String and addet the methods to format the data there.


Bast regards
Pirmin

>
> Best regards
> Norman
>
> --
> Dr.-Ing. Norman Feske
> Genode Labs
>
> http://www.genode-labs.com · http://genode.org
>
> Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
> Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth








More information about the users mailing list