本文整理匯總了C++中GETENV函數的典型用法代碼示例。如果您正苦於以下問題:C++ GETENV函數的具體用法?C++ GETENV怎麽用?C++ GETENV使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GETENV函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
}
}
}
}