本文整理汇总了C++中PUTENV函数的典型用法代码示例。如果您正苦于以下问题:C++ PUTENV函数的具体用法?C++ PUTENV怎么用?C++ PUTENV使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PUTENV函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CWE427_Uncontrolled_Search_Path_Element__char_file_03_bad
void CWE427_Uncontrolled_Search_Path_Element__char_file_03_bad()
{
char * data;
char dataBuffer[250] = "PATH=";
data = dataBuffer;
if(5==5)
{
{
/* Read input from a file */
size_t dataLen = strlen(data);
FILE * pFile;
/* if there is room in data, attempt to read the input from a file */
if (250-dataLen > 1)
{
pFile = fopen(FILENAME, "r");
if (pFile != NULL)
{
/* POTENTIAL FLAW: Read data from a file */
if (fgets(data+dataLen, (int)(250-dataLen), pFile) == NULL)
{
printLine("fgets() failed");
/* Restore NUL terminator if fgets fails */
data[dataLen] = '\0';
}
fclose(pFile);
}
}
}
}
/* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */
PUTENV(data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:32,代码来源:CWE427_Uncontrolled_Search_Path_Element__char_file_03.c
示例2: badSink
void badSink(vector<char *> dataVector)
{
/* copy data out of dataVector */
char * data = dataVector[2];
/* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */
PUTENV(data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:7,代码来源:CWE427_Uncontrolled_Search_Path_Element__char_file_72b.cpp
示例3: badSink
void badSink(map<int, wchar_t *> dataMap)
{
/* copy data out of dataMap */
wchar_t * data = dataMap[2];
/* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */
PUTENV(data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:7,代码来源:CWE427_Uncontrolled_Search_Path_Element__wchar_t_console_74b.cpp
示例4: badSink
void badSink(list<wchar_t *> dataList)
{
/* copy data out of dataList */
wchar_t * data = dataList.back();
/* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */
PUTENV(data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:7,代码来源:CWE427_Uncontrolled_Search_Path_Element__wchar_t_listen_socket_73b.cpp
示例5: CWE427_Uncontrolled_Search_Path_Element__char_connect_socket_66b_badSink
void CWE427_Uncontrolled_Search_Path_Element__char_connect_socket_66b_badSink(char * dataArray[])
{
/* copy data out of dataArray */
char * data = dataArray[2];
/* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */
PUTENV(data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:7,代码来源:CWE427_Uncontrolled_Search_Path_Element__char_connect_socket_66b.c
示例6: deleteArray
void ProcessEnv::resetEnv(const char* envName)
{
if (!envName)
return;
Int32 i;
size_t nameLen=strlen(envName);
CollHeap *stmtHeap = CmpCommon::statementHeap();
NAList<Int32> deleteArray(stmtHeap, 16); // 16 should be more than enough
// find the env in existing env array
for (i=0; i < envs_.getSize(); i++)
{
if (envs_.used(i))
{
char* pTemp = strchr(envs_[i], '=');
if (pTemp) // found '='
{
Int32 envLen = (Int32)(pTemp - envs_[i]);
if (envLen == nameLen && strncmp(envName, envs_[i], nameLen) == 0 )
{ // found matching env var name
*(pTemp) = '\0';
PUTENV(envs_[i]);
NADELETEBASIC(envs_[i], heap_);
deleteArray.insert(i);
}
}
}
}
// remove from the env array
for (Int32 j = 0; j < deleteArray.entries(); j++) {
envs_.remove(deleteArray[j]);
}
}
开发者ID:AlexPeng19,项目名称:incubator-trafodion,代码行数:35,代码来源:ProcessEnv.cpp
示例7: goodG2B
/* goodG2B uses the GoodSource with the BadSink */
static void goodG2B()
{
wchar_t * data;
wchar_t dataBuffer[250] = L"PATH=";
data = dataBuffer;
data = goodG2BSource(data);
/* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */
PUTENV(data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:10,代码来源:CWE427_Uncontrolled_Search_Path_Element__wchar_t_environment_42.c
示例8: CWE427_Uncontrolled_Search_Path_Element__wchar_t_listen_socket_64b_goodG2BSink
/* goodG2B uses the GoodSource with the BadSink */
void CWE427_Uncontrolled_Search_Path_Element__wchar_t_listen_socket_64b_goodG2BSink(void * dataVoidPtr)
{
/* cast void pointer to a pointer of the appropriate type */
wchar_t * * dataPtr = (wchar_t * *)dataVoidPtr;
/* dereference dataPtr into data */
wchar_t * data = (*dataPtr);
/* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */
PUTENV(data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:10,代码来源:CWE427_Uncontrolled_Search_Path_Element__wchar_t_listen_socket_64b.c
示例9: CWE427_Uncontrolled_Search_Path_Element__wchar_t_environment_42_bad
void CWE427_Uncontrolled_Search_Path_Element__wchar_t_environment_42_bad()
{
wchar_t * data;
wchar_t dataBuffer[250] = L"PATH=";
data = dataBuffer;
data = badSource(data);
/* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */
PUTENV(data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:9,代码来源:CWE427_Uncontrolled_Search_Path_Element__wchar_t_environment_42.c
示例10: goodG2B
static void goodG2B()
{
char * data;
char dataBuffer[250] = "PATH=";
data = dataBuffer;
data = CWE427_Uncontrolled_Search_Path_Element__char_listen_socket_61b_goodG2BSource(data);
/* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */
PUTENV(data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:9,代码来源:CWE427_Uncontrolled_Search_Path_Element__char_listen_socket_61a.c
示例11: strchr
void ProcessEnv::addOrChangeEnv(char **newenvs, Lng32 nEnvs)
{
Lng32 i,j;
for (i=0; i < nEnvs; i++)
{
char* pTemp = strchr(newenvs[i], '=');
if (pTemp)
{
NABoolean sameValue = FALSE;
Int32 envNameLen = pTemp - (newenvs[i]) + 1; // including '='
char* envName = new char[envNameLen+1];
strncpy(envName, newenvs[i], envNameLen);
envName[envNameLen] = '\0';
NABoolean envChanged = FALSE;
CollIndex entriesChecked = 0;
for (j=0; entriesChecked < envs_.entries(); j++)
{
if ( envs_.used(j) )
{
if (strcmp(newenvs[i], envs_[j]) == 0)
{
sameValue = TRUE;
break;
}
else if (strncmp(envName, envs_[j], envNameLen) == 0)
{
envChanged = TRUE;
break;
}
entriesChecked++;
}
}
if (!sameValue)
{
CollIndex index = j; // Put to the same location if value changed
if ( envChanged )
{
NADELETEBASIC(envs_[j], heap_);
envs_.remove(j);
}
else
index = envs_.unusedIndex(); // Insert a new env string
UInt32 len = strlen(newenvs[i]);
char *copyEnv = new (heap_) char[len + 1];
strcpy(copyEnv, newenvs[i]);
copyEnv[len] = 0;
PUTENV(copyEnv);
envs_.insertAt(index, copyEnv);
}
delete[] envName;
}
}
}
开发者ID:AlexPeng19,项目名称:incubator-trafodion,代码行数:57,代码来源:ProcessEnv.cpp
示例12: CWE427_Uncontrolled_Search_Path_Element__char_listen_socket_22_bad
void CWE427_Uncontrolled_Search_Path_Element__char_listen_socket_22_bad()
{
char * data;
char dataBuffer[250] = "PATH=";
data = dataBuffer;
CWE427_Uncontrolled_Search_Path_Element__char_listen_socket_22_badGlobal = 1; /* true */
data = CWE427_Uncontrolled_Search_Path_Element__char_listen_socket_22_badSource(data);
/* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */
PUTENV(data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:10,代码来源:CWE427_Uncontrolled_Search_Path_Element__char_listen_socket_22a.c
示例13: goodG2B1
static void goodG2B1()
{
char * data;
char dataBuffer[250] = "PATH=";
data = dataBuffer;
goodG2B1Static = 0; /* false */
data = goodG2B1Source(data);
/* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */
PUTENV(data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:10,代码来源:CWE427_Uncontrolled_Search_Path_Element__char_environment_21.c
示例14: goodG2B2
static void goodG2B2()
{
char * data;
char dataBuffer[250] = "PATH=";
data = dataBuffer;
CWE427_Uncontrolled_Search_Path_Element__char_console_22_goodG2B2Global = 1; /* true */
data = CWE427_Uncontrolled_Search_Path_Element__char_console_22_goodG2B2Source(data);
/* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */
PUTENV(data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:10,代码来源:CWE427_Uncontrolled_Search_Path_Element__char_console_22a.c
示例15: goodG2B
/* goodG2B() - use goodsource and badsink by reversing the blocks on the goto statement */
static void goodG2B()
{
char * data;
char dataBuffer[250] = "PATH=";
data = dataBuffer;
goto source;
source:
/* FIX: Set the path as the "system" path */
strcat(data, NEW_PATH);
/* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */
PUTENV(data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:13,代码来源:CWE427_Uncontrolled_Search_Path_Element__char_connect_socket_18.c
示例16: goodG2B2
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */
static void goodG2B2()
{
wchar_t * data;
wchar_t dataBuffer[250] = L"PATH=";
data = dataBuffer;
if(staticTrue)
{
/* FIX: Set the path as the "system" path */
wcscat(data, NEW_PATH);
}
/* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */
PUTENV(data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:14,代码来源:CWE427_Uncontrolled_Search_Path_Element__wchar_t_connect_socket_05.c
示例17: goodG2B2
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */
static void goodG2B2()
{
char * data;
char dataBuffer[250] = "PATH=";
data = dataBuffer;
if(GLOBAL_CONST_FIVE==5)
{
/* FIX: Set the path as the "system" path */
strcat(data, NEW_PATH);
}
/* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */
PUTENV(data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:14,代码来源:CWE427_Uncontrolled_Search_Path_Element__char_environment_13.c
示例18: goodG2B
/* goodG2B() - use goodsource and badsink by changing the conditions on the for statements */
static void goodG2B()
{
int h;
char * data;
char dataBuffer[250] = "PATH=";
data = dataBuffer;
for(h = 0; h < 1; h++)
{
/* FIX: Set the path as the "system" path */
strcat(data, NEW_PATH);
}
/* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */
PUTENV(data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:15,代码来源:CWE427_Uncontrolled_Search_Path_Element__char_connect_socket_17.c
示例19: goodG2B
/* goodG2B() uses the GoodSource with the BadSink */
static void goodG2B()
{
char * data;
CWE427_Uncontrolled_Search_Path_Element__char_listen_socket_34_unionType myUnion;
char dataBuffer[250] = "PATH=";
data = dataBuffer;
/* FIX: Set the path as the "system" path */
strcat(data, NEW_PATH);
myUnion.unionFirst = data;
{
char * data = myUnion.unionSecond;
/* POTENTIAL FLAW: Set a new environment variable with a path that is possibly insecure */
PUTENV(data);
}
}
开发者ID:maurer,项目名称:tiamat,代码行数:16,代码来源:CWE427_Uncontrolled_Search_Path_Element__char_listen_socket_34.c
示例20: strchr
Int32 Envvar::reset()
{
if ((!getenv(name)) || (!env_str)) // this should be true,
return -1; // otherwise its an internal error.
// VO, Plan versioning support: The code below '#else' will not
// reset the env var properly on NT, a subsequent 'sh env;' command
// will still display it with its original value.
char * ptr = strchr (env_str, '=');
ptr[1] = 0;
Int32 i = PUTENV(env_str);
if (i) cerr << "*** ERROR " << i << " from putenv." << endl;
invalidateEnvVarDependentCaches(name);
return 0;
}
开发者ID:RuoYuHP,项目名称:incubator-trafodion,代码行数:17,代码来源:Define.cpp
注:本文中的PUTENV函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论