centos 7
format weakness #24

4

Weakness Breakdown


Definition:

A format string exploit occurs when the data of an input string is evaluated as a command by the program. This class of attacks is very similar to buffer overflows since an attacker could execute code, read the stack or cause new behaviors that compromise security. Learn more about format string attacks on OWASP attack index.

Warning code(s):

If format strings can be influenced by an attacker, they can be exploited.

File Name:

libquvi-0.4.1/examples/common.c

Context:

The highlighted line of code below is the trigger point of this particular Centos 7 format weakness.

  *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301  USA
 */

/* common.c - common functions used by the examples */

#include <stdio.h>
#include <stdarg.h>
#include <quvi/quvi.h>

#include "common.h"

void spew_e(const char *fmt, ...)
{
  va_list ap;
  va_start(ap, fmt);
  vfprintf(stderr, fmt, ap);
  va_end(ap);
}

void check_error(quvi_t q, QUVIcode rc)
{
  if (rc == QUVI_OK)
    return;

  fprintf(stderr, "error: %s\n", quvi_strerror(q, rc));

  if (q != NULL)
    quvi_close(&q);

  exit(1);
}

void handle_resolve_status(quvi_word type)
{
  if (type == QUVISTATUSTYPE_DONE)
    spew_e("done.\n");
  else
    spew_e(":: Check for URL redirection ...");
}

void handle_fetch_status(quvi_word type, void *p) 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.