Ignore:
Timestamp:
Feb 28, 2010, 9:59:12 PM (11 years ago)
Author:
jmr@…
Message:

error checking, sprintf -> snprintf, strcpy -> strncpy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/registry2.0/util.c

    r64269 r64294  
    5252 */
    5353char* unique_name(Tcl_Interp* interp, char* prefix) {
    54     char* result = malloc(strlen(prefix) + TCL_INTEGER_SPACE + 1);
     54    int result_size = strlen(prefix) + TCL_INTEGER_SPACE + 1;
     55    char* result = malloc(result_size);
    5556    Tcl_CmdInfo info;
    5657    int i;
    5758    for (i=0; ; i++) {
    58         sprintf(result, "%s%d", prefix, i);
     59        snprintf(result, result_size, "%s%d", prefix, i);
    5960        if (Tcl_GetCommandInfo(interp, result, &info) == 0) {
    6061            break;
Note: See TracChangeset for help on using the changeset viewer.