本文整理汇总了C++中GETENV函数的典型用法代码示例。如果您正苦于以下问题:C++ GETENV函数的具体用法?C++ GETENV怎么用?C++ GETENV使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GETENV函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: strlen
CWE134_Uncontrolled_Format_String__char_environment_vfprintf_84_goodB2G::CWE134_Uncontrolled_Format_String__char_environment_vfprintf_84_goodB2G(char * dataCopy)
{
data = dataCopy;
{
/* Append input from an environment variable to data */
size_t dataLen = strlen(data);
char * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
strncat(data+dataLen, environment, 100-dataLen-1);
}
}
}
开发者ID:maurer,项目名称:tiamat,代码行数:15,代码来源:CWE134_Uncontrolled_Format_String__char_environment_vfprintf_84_goodB2G.cpp
示例2: strlen
CWE23_Relative_Path_Traversal__char_environment_fopen_84_bad::CWE23_Relative_Path_Traversal__char_environment_fopen_84_bad(char * dataCopy)
{
data = dataCopy;
{
/* Append input from an environment variable to data */
size_t dataLen = strlen(data);
char * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
strncat(data+dataLen, environment, FILENAME_MAX-dataLen-1);
}
}
}
开发者ID:maurer,项目名称:tiamat,代码行数:15,代码来源:CWE23_Relative_Path_Traversal__char_environment_fopen_84_bad.cpp
示例3: CWE78_OS_Command_Injection__wchar_t_environment_w32_spawnv_61b_badSource
wchar_t * CWE78_OS_Command_Injection__wchar_t_environment_w32_spawnv_61b_badSource(wchar_t * data)
{
{
/* Append input from an environment variable to data */
size_t dataLen = wcslen(data);
wchar_t * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
wcsncat(data+dataLen, environment, 100-dataLen-1);
}
}
return data;
}
开发者ID:maurer,项目名称:tiamat,代码行数:15,代码来源:CWE78_OS_Command_Injection__wchar_t_environment_w32_spawnv_61b.c
示例4: wcslen
CWE36_Absolute_Path_Traversal__wchar_t_environment_ofstream_84_bad::CWE36_Absolute_Path_Traversal__wchar_t_environment_ofstream_84_bad(wchar_t * dataCopy)
{
data = dataCopy;
{
/* Append input from an environment variable to data */
size_t dataLen = wcslen(data);
wchar_t * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
wcsncat(data+dataLen, environment, FILENAME_MAX-dataLen-1);
}
}
}
开发者ID:maurer,项目名称:tiamat,代码行数:15,代码来源:CWE36_Absolute_Path_Traversal__wchar_t_environment_ofstream_84_bad.cpp
示例5: badSource
static wchar_t * badSource(wchar_t * data)
{
{
/* Append input from an environment variable to data */
size_t dataLen = wcslen(data);
wchar_t * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
wcsncat(data+dataLen, environment, 100-dataLen-1);
}
}
return data;
}
开发者ID:maurer,项目名称:tiamat,代码行数:15,代码来源:CWE78_OS_Command_Injection__wchar_t_environment_popen_42.c
示例6: CWE134_Uncontrolled_Format_String__wchar_t_environment_vprintf_61b_goodB2GSource
/* goodB2G() uses the BadSource with the GoodSink */
wchar_t * CWE134_Uncontrolled_Format_String__wchar_t_environment_vprintf_61b_goodB2GSource(wchar_t * data)
{
{
/* Append input from an environment variable to data */
size_t dataLen = wcslen(data);
wchar_t * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
wcsncat(data+dataLen, environment, 100-dataLen-1);
}
}
return data;
}
开发者ID:maurer,项目名称:tiamat,代码行数:16,代码来源:CWE134_Uncontrolled_Format_String__wchar_t_environment_vprintf_61b.c
示例7: strlen
CWE78_OS_Command_Injection__char_environment_execlp_84_bad::CWE78_OS_Command_Injection__char_environment_execlp_84_bad(char * dataCopy)
{
data = dataCopy;
{
/* Append input from an environment variable to data */
size_t dataLen = strlen(data);
char * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
strncat(data+dataLen, environment, 100-dataLen-1);
}
}
}
开发者ID:maurer,项目名称:tiamat,代码行数:15,代码来源:CWE78_OS_Command_Injection__char_environment_execlp_84_bad.cpp
示例8: badSource
char * badSource(char * data)
{
{
/* Append input from an environment variable to data */
size_t dataLen = strlen(data);
char * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
strncat(data+dataLen, environment, FILENAME_MAX-dataLen-1);
}
}
return data;
}
开发者ID:maurer,项目名称:tiamat,代码行数:15,代码来源:CWE23_Relative_Path_Traversal__char_environment_open_61b.cpp
示例9: wcslen
CWE114_Process_Control__w32_wchar_t_environment_84_bad::CWE114_Process_Control__w32_wchar_t_environment_84_bad(wchar_t * dataCopy)
{
data = dataCopy;
{
/* Append input from an environment variable to data */
size_t dataLen = wcslen(data);
wchar_t * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
wcsncat(data+dataLen, environment, 100-dataLen-1);
}
}
}
开发者ID:gpwi970725,项目名称:testJuliet1,代码行数:15,代码来源:CWE114_Process_Control__w32_wchar_t_environment_84_bad.cpp
示例10: wcslen
CWE78_OS_Command_Injection__wchar_t_environment_w32_execvp_83_bad::CWE78_OS_Command_Injection__wchar_t_environment_w32_execvp_83_bad(wchar_t * dataCopy)
{
data = dataCopy;
{
/* Append input from an environment variable to data */
size_t dataLen = wcslen(data);
wchar_t * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
wcsncat(data+dataLen, environment, 100-dataLen-1);
}
}
}
开发者ID:maurer,项目名称:tiamat,代码行数:15,代码来源:CWE78_OS_Command_Injection__wchar_t_environment_w32_execvp_83_bad.cpp
示例11: wcslen
CWE134_Uncontrolled_Format_String__wchar_t_environment_snprintf_83_bad::CWE134_Uncontrolled_Format_String__wchar_t_environment_snprintf_83_bad(wchar_t * dataCopy)
{
data = dataCopy;
{
/* Append input from an environment variable to data */
size_t dataLen = wcslen(data);
wchar_t * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
wcsncat(data+dataLen, environment, 100-dataLen-1);
}
}
}
开发者ID:maurer,项目名称:tiamat,代码行数:15,代码来源:CWE134_Uncontrolled_Format_String__wchar_t_environment_snprintf_83_bad.cpp
示例12: GC_print_all_errors
/* Clear both lists. Called without the allocation lock held. */
GC_INNER void GC_print_all_errors(void)
{
static GC_bool printing_errors = FALSE;
GC_bool have_errors;
unsigned i;
DCL_LOCK_STATE;
LOCK();
if (printing_errors) {
UNLOCK();
return;
}
have_errors = GC_have_errors;
printing_errors = TRUE;
UNLOCK();
if (GC_debugging_started) {
GC_print_all_smashed();
} else {
have_errors = FALSE;
}
for (i = 0; i < GC_n_leaked; ++i) {
ptr_t p = GC_leaked[i];
if (HDR(p) -> hb_obj_kind == PTRFREE) {
GC_err_printf("Leaked atomic object at ");
} else {
GC_err_printf("Leaked composite object at ");
}
GC_print_heap_obj(p);
GC_err_printf("\n");
GC_free(p);
GC_leaked[i] = 0;
have_errors = TRUE;
}
GC_n_leaked = 0;
if (have_errors
# ifndef GC_ABORT_ON_LEAK
&& GETENV("GC_ABORT_ON_LEAK") != NULL
# endif
) {
ABORT("Leaked or smashed objects encountered");
}
printing_errors = FALSE;
}
开发者ID:preames,项目名称:hinted-collection,代码行数:48,代码来源:reclaim.c
示例13: sst1InitDacDetectICS
FxBool sst1InitDacDetectICS(FxU32 * sstbase)
{
FxU32 n;
int helper = (GETENV(("SST_DEBUGDAC"))) ? 1 : 0;
if(helper)
INIT_PRINTF(("sst1InitDacDetectICS(): Entered...\n"));
/* Detect ICS... */
/* Sometimes the DACs seem to go into never-never land, so */
/* try and initialize the DAC multiple times */
n = 0;
while(1) {
FxU32 gclk1, vclk1, vclk7;
if(++n > 100)
break;
/* Must guarantee that no rendering is being performed */
sst1InitIdleFBINoNOP(sstbase);
sst1InitDacWr(sstbase, SST_DACREG_ICS_PLLADDR_RD,
SST_DACREG_ICS_PLLADDR_GCLK1);
gclk1 = sst1InitDacRd(sstbase, SST_DACREG_ICS_PLLADDR_DATA);
sst1InitDacRd(sstbase, SST_DACREG_ICS_PLLADDR_DATA);
sst1InitDacWr(sstbase, SST_DACREG_ICS_PLLADDR_RD,
SST_DACREG_ICS_PLLADDR_VCLK1);
vclk1 = sst1InitDacRd(sstbase, SST_DACREG_ICS_PLLADDR_DATA);
sst1InitDacRd(sstbase, SST_DACREG_ICS_PLLADDR_DATA);
sst1InitDacWr(sstbase, SST_DACREG_ICS_PLLADDR_RD,
SST_DACREG_ICS_PLLADDR_VCLK7);
vclk7 = sst1InitDacRd(sstbase, SST_DACREG_ICS_PLLADDR_DATA);
sst1InitDacRd(sstbase, SST_DACREG_ICS_PLLADDR_DATA);
if((gclk1 == SST_DACREG_ICS_PLLADDR_GCLK1_DEFAULT) &&
(vclk1 == SST_DACREG_ICS_PLLADDR_VCLK1_DEFAULT) &&
(vclk7 == SST_DACREG_ICS_PLLADDR_VCLK7_DEFAULT)) {
/* found ICS DAC... */
sst1CurrentBoard->fbiDacType = SST_FBI_DACTYPE_ICS;
if(helper)
INIT_PRINTF(("sst1InitDacDetectICS(): Exiting...\n"));
return(FXTRUE);
}
}
if(helper)
INIT_PRINTF(("sst1InitDacDetectICS(): Exiting...\n"));
return(FXFALSE);
}
开发者ID:OS2World,项目名称:LIB-Glide-2,代码行数:46,代码来源:dac.c
示例14: parseuri
struct ProxyStruct parseuri(char *uri)
{
struct ProxyStruct ret;
char **atmp;
char tmpfiletmp[64];
struct growstring grow;
int i;
/* Verify we got something */
assert(uri);
/* Initialize the growstring */
grow.size=1024*sizeof(char);
grow.string=calloc(sizeof(char), grow.size);
/* Copy the uri */
ret.request_uri=strdup(uri);
/* we prepend each part with a / in the for loop */
str_append(&grow, "http:/");
atmp=split('/', uri);
for(i=3; atmp[i]!=NULL; i++) {
str_append(&grow, "/");
str_append(&grow, atmp[i]);
}
/* Get the URL stuff */
ret.request_url=strdup(grow.string);
ret.url=parseurl(ret.request_url);
/* Get the file */
grow.string[0]=0x00;
str_append(&grow, GETENV("DOCUMENT_ROOT"));
str_append(&grow, "/");
str_append(&grow, ret.request_uri);
ret.file=strdup(grow.string);
sprintf(tmpfiletmp, ".tmp.%d", getpid());
str_append(&grow, tmpfiletmp);
ret.tmpfile=grow.string;
freeptrlist(atmp);
return(ret);
}
开发者ID:WongTai,项目名称:snippets,代码行数:46,代码来源:main.c
示例15: goodB2G1
/* goodB2G1() - use badsource and goodsink by changing the second staticReturnsTrue() to staticReturnsFalse() */
static void goodB2G1()
{
wchar_t * data;
wchar_t dataBuffer[100] = L"";
data = dataBuffer;
if(staticReturnsTrue())
{
{
/* Append input from an environment variable to data */
size_t dataLen = wcslen(data);
wchar_t * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
wcsncat(data+dataLen, environment, 100-dataLen-1);
}
}
}
if(staticReturnsFalse())
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
{
int i, n, intVariable;
if (swscanf(data, L"%d", &n) == 1)
{
/* FIX: limit loop iteration counts */
if (n < MAX_LOOP)
{
intVariable = 0;
for (i = 0; i < n; i++)
{
/* INCIDENTAL: CWE 561: Dead Code - non-avoidable if n <= 0 */
intVariable++; /* avoid a dead/empty code block issue */
}
printIntLine(intVariable);
}
}
}
}
}
开发者ID:maurer,项目名称:tiamat,代码行数:46,代码来源:CWE606_Unchecked_Loop_Condition__wchar_t_environment_08.c
示例16: goodB2G
static void goodB2G()
{
char * data;
char dataBuffer[100] = "";
data = dataBuffer;
{
/* Append input from an environment variable to data */
size_t dataLen = strlen(data);
char * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
strncat(data+dataLen, environment, 100-dataLen-1);
}
}
CWE134_Uncontrolled_Format_String__char_environment_snprintf_64b_goodB2GSink(&data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:18,代码来源:CWE134_Uncontrolled_Format_String__char_environment_snprintf_64a.c
示例17: goodB2G
/* goodB2G uses the BadSource with the GoodSink */
static void goodB2G()
{
wchar_t * data;
data = (wchar_t *)malloc(100*sizeof(wchar_t));
data[0] = L'\0';
{
/* Append input from an environment variable to data */
size_t dataLen = wcslen(data);
wchar_t * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
wcsncat(data+dataLen, environment, 100-dataLen-1);
}
}
CWE761_Free_Pointer_Not_at_Start_of_Buffer__wchar_t_environment_51b_goodB2GSink(data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:19,代码来源:CWE761_Free_Pointer_Not_at_Start_of_Buffer__wchar_t_environment_51a.c
示例18: CWE78_OS_Command_Injection__char_environment_system_53_bad
void CWE78_OS_Command_Injection__char_environment_system_53_bad()
{
char * data;
char data_buf[100] = FULL_COMMAND;
data = data_buf;
{
/* Append input from an environment variable to data */
size_t dataLen = strlen(data);
char * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
strncat(data+dataLen, environment, 100-dataLen-1);
}
}
CWE78_OS_Command_Injection__char_environment_system_53b_badSink(data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:18,代码来源:CWE78_OS_Command_Injection__char_environment_system_53a.c
示例19: goodB2G
static void goodB2G()
{
char * data;
char dataBuffer[100] = "";
data = dataBuffer;
{
/* Append input from an environment variable to data */
size_t dataLen = strlen(data);
char * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
strncat(data+dataLen, environment, 100-dataLen-1);
}
}
goodB2GSink(data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:18,代码来源:CWE134_Uncontrolled_Format_String__char_environment_w32_vsnprintf_41.c
示例20: bad
void bad()
{
wchar_t * data;
wchar_t dataBuffer[FILENAME_MAX] = BASEPATH;
data = dataBuffer;
{
/* Append input from an environment variable to data */
size_t dataLen = wcslen(data);
wchar_t * environment = GETENV(ENV_VARIABLE);
/* If there is data in the environment variable */
if (environment != NULL)
{
/* POTENTIAL FLAW: Read data from an environment variable */
wcsncat(data+dataLen, environment, FILENAME_MAX-dataLen-1);
}
}
badSink(data);
}
开发者ID:maurer,项目名称:tiamat,代码行数:18,代码来源:CWE23_Relative_Path_Traversal__wchar_t_environment_ofstream_41.cpp
注:本文中的GETENV函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论