[SSSD] [PATCH] UTIL: Fix access out of bound in parse_args
Nikolai Kondrashov
Nikolai.Kondrashov at redhat.com
Wed Jun 25 09:54:50 UTC 2014
On 06/25/2014 11:35 AM, Pavel Reichl wrote:
> On Wed, 2014-06-25 at 09:54 +0200, Lukas Slebodnik wrote:
>> Previously I didn't want to use '\t' instead of tabs because there is lof of
>> backslashes anyway.
>>
>> Let's compare
>> diff --git a/src/tests/util-tests.c b/src/tests/util-tests.c
>> index 5ef0102..4f47305 100644
>> --- a/src/tests/util-tests.c
>> +++ b/src/tests/util-tests.c
>> @@ -142,7 +142,7 @@ START_TEST(test_parse_args)
>> const char *parsed7[] = { "foo", "a", "f", NULL };
>> const char *parsed8[] = { "foo", "a\tg", NULL };
>> const char *parsed9[] = { "foo", NULL };
>> - const char *parsed10[] = { " ", "foo", " ", "\\'", NULL };
>> + const char *parsed10[] = { " ", "foo", "\t", "\\'", NULL };
>> const char *parsed11[] = { "a", NULL };
>> struct pa_testcase tc[] = {
>> { "foo", parsed1 },
>> @@ -151,14 +151,14 @@ START_TEST(test_parse_args)
>> { "foo a\\ c", parsed4 },
>> { "foo a d ", parsed5 },
>> { "foo a e ", parsed6 },
>> - { "foo a f ", parsed7 },
>> + { "foo\ta\t \tf \t", parsed7 },
>> { "foo a\\\tg", parsed8 },
>> { " foo ", parsed9 },
>> - { "\\ foo \\ \\' ", parsed10 },
>> + { "\\ foo \\\t \\' ", parsed10 },
>> { "a", parsed11 },
>> { " ", NULL },
>> { "", NULL },
>> - { " ", NULL },
>> + { " \t ", NULL },
>> { NULL, NULL }
>> };
>>
>> Each normal editor can show difference between tabs and spaces
>> IMO, It looks to me like obfluscation after replacement.
>>
> I personally prefer \t version, but I respect your opinion so unless
> somebody else prefers explicit \t too, please keep you original version
> as is.
The slash forest sure looks ugly, but I would prefer \t's as well, as they
make the code less ambiguous and somewhat easier to read. I generally avoid
enabling tab highlighting in the editor, as it makes code using them look too
noisy.
Nick
More information about the sssd-devel
mailing list