⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cgi-send.c

📁 最新的版本ACE-5.6.8,刚从外文网上搬下,与大家分享.
💻 C
字号:
/* $Id: cgi-send.c 81993 2008-06-16 20:26:16Z sowayaa $ */
/*
 * Send 10K file; send random bits.
 *
 */

//FUZZ: disable check_for_improper_main_declaration

#include <stdio.h>
#include <stdlib.h>

#define FILE_SIZE       10240
#define MALLOC_FAILURE  "Out of memory"

int
main()
{
  int filesize;
  char *str_filesize;
  char *buffer;
  int index;

  printf("Content-type: text/plain\r\n\r\n");

  if ( !(str_filesize = getenv("QUERY_STRING")) )
    filesize = FILE_SIZE;
  else {
    if ( !strncmp(str_filesize, "size=", 5) )
      filesize = atoi(&(str_filesize[5]));
    else
      filesize = FILE_SIZE;
  }

  if ( !(buffer = (char *)malloc(filesize)) ) {
    fwrite(MALLOC_FAILURE, strlen(MALLOC_FAILURE), 1, stdout);
    return -1;
  }

  for (index=0; index< filesize; index++)
    /* generate random characters from A-Z */
    buffer[index] = rand() %26 + 63;

  fwrite(buffer, filesize, 1, stdout);

  free(buffer);

  return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -