Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Safe to change argv?

Reply
Thread Tools

Safe to change argv?

 
 
Why Tea
Guest
Posts: n/a
 
      03-25-2011
When a program receives its command line arguments,
e.g. -abc some_value, is it safe to change "-abc"
to "--abc"? In general, how safe is it to extend an
argv to less than MAX_ARG_STRLEN?

/Why Tea
 
Reply With Quote
 
 
 
 
Barry Schwarz
Guest
Posts: n/a
 
      03-26-2011
On Fri, 25 Mar 2011 16:51:21 -0700 (PDT), Why Tea <(E-Mail Removed)>
wrote:

>When a program receives its command line arguments,
>e.g. -abc some_value, is it safe to change "-abc"
>to "--abc"? In general, how safe is it to extend an
>argv to less than MAX_ARG_STRLEN?


Paragraph 5.1.2.2.1-2 guarantees that you can change the value of the
5 bytes in the string "-abc". It does not say anything about the
memory that follows the string. It is entirely possible for the "6th
byte" to be part of the next command line argument. It is also
possible for the bytes that follow the string to hold system specific
data needed when main returns to your host environment.

All in all it sounds like a really bad idea (tm).

--
Remove del for email
 
Reply With Quote
 
 
 
 
Keith Thompson
Guest
Posts: n/a
 
      03-26-2011
Why Tea <(E-Mail Removed)> writes:
> When a program receives its command line arguments,
> e.g. -abc some_value, is it safe to change "-abc"
> to "--abc"? In general, how safe is it to extend an
> argv to less than MAX_ARG_STRLEN?


Why do you want to do this?

--
Keith Thompson (The_Other_Keith) http://www.velocityreviews.com/forums/(E-Mail Removed) <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
os.ChDir() not thread-safe; was : Is tempfile.mkdtemp() thread-safe? Gabriel Rossetti Python 0 08-29-2008 08:30 AM
Safe Mode (?) - It is meant to be normal mode but looks like safe mode English Patient Computer Support 3 10-03-2004 11:10 PM
Re: Those cute little "WORK-SAFE" / "NOT WORK-SAFE" tags that people put in the Subject headers of their posts... Soapy Digital Photography 1 08-16-2004 12:07 PM
Re: Those cute little "WORK-SAFE" / "NOT WORK-SAFE" tags that people put in the Subject headers of their posts... Soapy Digital Photography 1 08-16-2004 06:24 AM
$SAFE = 5 and Safe Ruby Misleading? kirindave@lensmen.net Ruby 1 08-11-2003 11:35 PM



Advertisments