bug-bash
[Top][All Lists]
Advanced

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

bash-4.2: poor order of conditionals


From: David Binderman
Subject: bash-4.2: poor order of conditionals
Date: Tue, 25 Oct 2011 20:54:43 +0000


Hello there,

I just ran the static analysis tool cppcheck over the source
code of bash-4.2

It said

[bash-4.2/builtins/mkbuiltins.c:554]: (style) Array index i is used before 
limits check

The source code is

      while (buffer[i] != '\n' && i < file_size)
        i++;

You might be better off with

      while (i < file_size && buffer[i] != '\n')
        i++;


Regards

David Binderman

                                          

reply via email to

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