Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 02-03-2005, 11:20 PM   #1
Registered: Nov 2002
Distribution: Slackware
Posts: 155

Rep: Reputation: 30
Validate input and preventing buffur overflows


I am writing a C++ app and the user is required to pass command line arguments. Lets for example say the user must pass there name and age by "--name=michael --age=99".

How do I go about validating the input and preventing the buffer overflows ?

Would I ...

1. Simple check the variable argv[i] lenght to make sure it is under 50 characters for example ?

2. How would I strip out any non-alphanumeric characters ?

I have tried googling and search ... but have not found anything

Old 02-04-2005, 01:55 AM   #2
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
You might like to try getopt instead of parsing it yourself (man 3 getopt).


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you validate the install of a new machine (Redhat)? FatDog Linux - Enterprise 6 06-23-2005 06:30 PM
overflows and hax: how does it work? nadroj Linux - Security 3 03-21-2005 12:27 AM
half-life could not validate cd munkie_poo Linux - Games 1 09-25-2004 09:39 PM
burning cd: buffer overflows in the OS?? drenal Linux - Software 1 01-27-2004 07:23 PM
Samba can't validate the users jen209110 Linux - Networking 1 01-12-2004 11:01 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:41 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration