🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #1278

Re: How to provide Shell Escape from a C program?

#1278
From: Guy Harris
Date: Fri, 23 Nov 1990 23:24
13 lines
1121 bytes
>>Can some body help me with this problem? 
>
>From the man page for strtok:

That's certainly *A* problem with his code, but far from the most
fundamental one, and not the one that's screwing him up.  The problem
that's screwing him up, as others have noted, is that the "-c" flag to
the shell takes *one* argument, which is a character string containing
the command to be executed, in its entirety; his use of "strtok()" to
try to carve the command up into tokens, and pass each token as an
individual argument to the shell, is incorrect - and would still be
incorrect even if he were correctly calling "strtok()" with a NULL
pointer as the first argument in all but the first call.
Technical Details
Message-ID: <4521@auspex.auspex.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!auspex!guy
References: <349@clbull.cl.bull.fr> <1990Nov20.150635.22378@ssd.kodak.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!auspex!guy
From: guy@auspex.auspex.com (Guy Harris)
Newsgroups: comp.unix.programmer
Subject: Re: How to provide Shell Escape from a C program?
Message-ID: <4521@auspex.auspex.com>
Date: 23 Nov 90 23:24:38 GMT
References: <349@clbull.cl.bull.fr> <1990Nov20.150635.22378@ssd.kodak.com>
Organization: Auspex Systems, Santa Clara
Lines: 13