Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-6395

One byte size shorter for name allocation in mgc_llog_local_copy()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • Lustre 2.8.0
    • Lustre 2.8.0, Lustre 2.5.5
    • None
    • 3
    • 9223372036854775807

      In mgc_llog_local_copy, the temp_log name allocation is a byte shorter than it should be, which will cause bufer over-run in the following sprintf.

      static int mgc_llog_local_copy(const struct lu_env *env,
                                     struct obd_device *obd,
                                     struct llog_ctxt *rctxt,
                                     struct llog_ctxt *lctxt, char *logname)
      {
              char    *temp_log;
              int      rc;
      
              ENTRY;
      
              /*
               * - copy it to backup using llog_backup()
               * - copy remote llog to logname using llog_backup()
               * - if failed then move bakup to logname again
               */
      
              OBD_ALLOC(temp_log, strlen(logname) + 1);
              if (!temp_log)
                      RETURN(-ENOMEM);
              sprintf(temp_log, "%sT", logname);
      

            di.wang Di Wang (Inactive)
            di.wang Di Wang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: