Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix array bounds checking #307

Merged
merged 1 commit into from
May 30, 2020
Merged

Commits on May 30, 2020

  1. Fix array bounds checking

    配列にアクセスした後で境界のチェックをしているとcppehckに指摘された
    箇所があったため条件の順序を修正します。
    
    cppcheckのレポート
    ```
    src/dbtree/nodetreejbbs.cpp:240:29: style: Array index 'pos' is used before limits check. [arrayIndexThenCheck]
                    while( lines[ pos ] != '\n' && pos < byte_lines ) ++pos;
                                ^
    src/dbtree/nodetreebase.cpp:1772:15: style: Array index 'i' is used before limits check. [arrayIndexThenCheck]
        while( str[ i ] != 's' && i < lng ) ++i;
                  ^
    src/jdlib/misctrip.cpp:129:33: style: Array index 'n' is used before limits check. [arrayIndexThenCheck]
                    for( n = 17; key[n] && n < 19; ++n )
                                    ^
    src/jdlib/miscutil.cpp:139:16: style: Array index 'i' is used before limits check. [arrayIndexThenCheck]
            if( str[ i ] == '\"' && (i < 1 || str[ i -1 ] != '\\') ){
                   ^
    ```
    ma8ma committed May 30, 2020
    Configuration menu
    Copy the full SHA
    5eda5db View commit details
    Browse the repository at this point in the history