Menu

#16 eurephiadm.c:253: possible array index out of range ?

v1.0.1
closed-fixed
None
5
2014-12-05
2014-12-05
dcb
No

eurephia-1.1.0/eurephiadm/eurephiadm.c:253]: (style) Array index 'dbargc' is used before limits check.

Source code is

    while( (dbargv[dbargc] != NULL) && (dbargc <= MAX_ARGUMENTS) ) {
            dbargv[++dbargc] = strtok(NULL, delims);
    }

but

   const char *dbargv[MAX_ARGUMENTS];

Discussion

  • David Sommerseth

    • status: open --> closed-fixed
    • assigned_to: David Sommerseth
     
  • David Sommerseth

    I've just pushed out an updated master and release/1.1 branch which fixes this issue.

    commit 51f8c8e930221cc5feeac4f84be5550b4e5be9dd (master)
    commit 3ddac122908f024e153abae83c232edf2d480f12 (release/1.1)
    Author: David Sommerseth <dazo@eurephia.org>
    Date:   Fri Dec 5 15:54:20 2014 +0100
    
        Correct ugly boundary checks in database init
    
        The check if dbargc exceeds MAX_ARGUMENTS was done _after_ it was checked
        if the array element is NULL.  This was not the intention.
    
        Signed-off-by: David Sommerseth <dazo@eurephia.org>
    
     

Log in to post a comment.

MongoDB Logo MongoDB