Ignore:
Timestamp:
Jan 27, 2011, 7:31:06 PM (13 years ago)
Author:
Bruno Cornec
Message:

r4176@localhost: bruno | 2011-01-26 18:11:02 +0100

  • Fix buffer overflow with long exclude lines where log between mindi and mondo were exceeding fixed string size used
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mondo/src/common/libmondo-fork.c

    r2656 r2700  
    379379
    380380    /*@ buffers **************************************************** */
    381     char tmp[MAX_STR_LEN * 2];
    382     char command[MAX_STR_LEN * 2];
     381    char *tmp = NULL;
     382    char *command = NULL;
    383383    char lockfile[MAX_STR_LEN];
    384384
     
    389389    sprintf(lockfile, "%s/mojo-jojo.bla.bla", bkpinfo->tmpdir);
    390390
    391     sprintf(command,
     391    mr_asprintf(&command,
    392392            "echo hi > %s ; %s >> %s 2>> %s; res=$?; sleep 1; rm -f %s; exit $res",
    393393            lockfile, basic_call, MONDO_LOGFILE, MONDO_LOGFILE, lockfile);
    394394    open_evalcall_form(what_i_am_doing);
    395     sprintf(tmp, "Executing %s", basic_call);
     395    mr_asprintf(&tmp, "Executing %s", basic_call);
    396396    log_msg(2, tmp);
     397    mr_free(tmp);
     398
    397399    if (!(fin = popen(command, "r"))) {
    398400        log_OS_error("Unable to popen-in command");
    399         sprintf(tmp, "Failed utterly to call '%s'", command);
     401        mr_asprintf(&tmp, "Failed utterly to call '%s'", command);
    400402        log_to_screen(tmp);
     403        mr_free(tmp);
     404        mr_free(command);
    401405        return (1);
    402406    }
     
    407411        }
    408412    }
     413    mr_free(command);
    409414#ifdef _XWIN
    410415    /* This only can update when newline goes into the file,
     
    412417    while (does_file_exist(lockfile)) {
    413418        while (!feof(fin)) {
     419            /* TODO: Dead and wrong code */
    414420            if (!fgets(tmp, 512, fin))
    415421                break;
Note: See TracChangeset for help on using the changeset viewer.