Re: [PATCH] syntax-check: forbid virBufferAsprintf with string literals

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

 



On 05/07/2013 04:32 PM, Eric Blake wrote:
> On 05/07/2013 05:46 AM, Ján Tomko wrote:
>> ---
>>  cfg.mk | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/cfg.mk b/cfg.mk
>> index 1d63bbd..06f89d1 100644
>> --- a/cfg.mk
>> +++ b/cfg.mk
>> @@ -490,6 +490,11 @@ sc_prohibit_virBufferAdd_with_string_literal:
>>  	halt='use virBufferAddLit, not virBufferAdd, with a string literal' \
>>  	  $(_sc_search_regexp)
>>  
>> +sc_prohibit_virBufferAsprintf_with_string_literal:
>> +	@prohibit='\<virBufferAsprintf *\([^,]+, *"([^%"]|\")*"\)'		\
>                                                   ^^^^^^^^^^^^^
> I think it's slightly tighter to write "([^%"\]|\\.|%%)*" to pick up all
> backslash sequences as well as literal % in a printf format, and so that
> a string that ends in a backslash ("foo\\") doesn't fail to find the
> closing ".  But those are corner cases; as written you catch 99.99% of
> offending code.
> 
>> +	halt='use virBufferAddLit, not virBufferAsprintf, with a string literal' \
>> +	  $(_sc_search_regexp)
> 
> ACK.
> 

Thank you, I've added the change you proposed and pushed it.

Jan

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]