Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6149567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:28:24+00:00 2026-05-23T19:28:24+00:00

I have a CGI script (compiled C program) that outputs its command line arguments

  • 0

I have a CGI script (compiled C program) that outputs its command line arguments (argv[0], argv[1] etc.).

If I try http://ajf.me/c/?abc I get “abc” as the second parameter.

However, if I try http://ajf.me/c/?a=bc I do not get any second parameter.

Why does using = stop the parameters from being passed to the program?

If it matters here is the C code:

#include <stdio.h>

int main (int argc, char *argv[]) {
    int i;
    printf("Content-Type: text/html;charset=utf-8\n\n");
    printf("<!DOCTYPE html>\n");
    printf("<html>\n");
    printf("<head>\n");
    printf("<title>ajf.me powered by ANSI C!</title>\n");
    printf("</head>\n");
    printf("<body>\n");
    printf("<h2>Supplied Arguments</h2>\n");
    printf("argc: %d\n", argc);
    printf("<ol>\n");
    for (i = 0; i < argc; ++i) {
        printf("<li>%s</li>\n", argv[i]);
    }
    printf("</ol>\n");
    printf("<em>Yes, this is vulnerable to null-byte injection. For instance, <a href=\"?Injected%%00Null\" style=\"font-family: monospace; color: green;\">?Injected\\0Null</a>.</em>\n");
    printf("</body>\n");
    printf("</html>\n");
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:28:26+00:00Added an answer on May 23, 2026 at 7:28 pm

    Passing parameters to a CGI program on its command line must be an anomaly of your web server. Normally the part after the ? is available in an environment variable called QUERY_STRING.

    It would probably be worthwhile for you to review the CGI specification.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP script that runs as a CGI program and the HTTP
I have written a CGI script that creates an image dynamically using GET data.
I have a website cgi-bin program that is written in c++. Unfortunately the website
I have a CGI script that does a lot things. I'm trying to keep
I have a web page that sends a request to a cgi script that
I'm running Lighttpd on Cygwin. I have a Lua CGI script that calls a
I have a CGI script run by Hiawatha web server that needs to return
My situation is that I have a POST cgi script that generates and returns
I have a web page that uses a Python cgi script to store requested
I have a cgi script which takes form input, I want to facilitate the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.