IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 24, 2006, 2:03:35 PM (20 years ago)
Author:
Paul Price
Message:

Removing more variable length arrays.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sys/psTrace.c

    r8575 r8577  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.75 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2006-08-24 23:52:00 $
     11 *  @version $Revision: 1.76 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2006-08-25 00:03:35 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5656#define MAX_HEADER_LENGTH 256
    5757#define MAX_TRACE_LENGTH 1024
     58#define MAX_COMPONENT_LENGTH 1024
    5859
    5960
     
    167168
    168169    psS32 i = 0;                        // Loop index variable.
    169     char name[strlen(addNodeName) + 1]; // buffer for writeable copy.
    170     char *pname = name;
     170    char name[MAX_COMPONENT_LENGTH]; // buffer for writeable copy.
    171171    char *firstComponent = NULL;        // first component of name
    172172    p_psComponent* currentNode = cRoot;
     
    193193    }
    194194
    195     strcpy(name, addNodeName);
    196     pname = name+1;
     195    strncpy(name, addNodeName, MAX_COMPONENT_LENGTH);
     196    char *pname = name+1;               // Take off the period
    197197    // Iterate through the components of addNodeName.  Strip off the first
    198198    // component of the name, find that in the root tree, or add it if it
     
    643643    PS_ASSERT_PTR_NON_NULL(format, );
    644644
     645    // XXX file & lineo are currently unused
     646
     647    // Append the function name to the facility
     648    size_t facilLength = strlen(facil); // Length of facility name
     649    char fullFacil[MAX_HEADER_LENGTH]; // Full facility name is the facility + the function name
     650    strncpy(&fullFacil[0], facil, MAX_HEADER_LENGTH);
     651    if (facilLength + 1 < MAX_HEADER_LENGTH) {
     652        fullFacil[facilLength] = '.';
     653        strncpy(&fullFacil[facilLength + 1], func, MAX_HEADER_LENGTH - facilLength - 1);
     654    }
     655
    645656    va_list ap;
    646657    va_start(ap, format);
    647 
    648     // XXX file & lineo are currently unused
    649 
    650     // Append the function name to the facility
    651     size_t facilLength = strlen(facil); // Length of facility name
    652     //size_t funcLength = strlen(func);   // Length of function name
    653     char fullFacil[MAX_HEADER_LENGTH]; // Full facility name is the facility + the function name
    654     strncpy(&fullFacil[0], facil, MAX_HEADER_LENGTH);
    655     fullFacil[facilLength] = '.';
    656     strncpy(&fullFacil[facilLength + 1], func, MAX_HEADER_LENGTH - facilLength - 1);
    657 
    658658    psTraceV(fullFacil, level, format, ap);
    659659    va_end(ap);
Note: See TracChangeset for help on using the changeset viewer.