Nit: Negating expressions like this is difficult to read.  This is much easier to read

    if (!g_ascii_isspace(envVarValue[i]) && !g_ascii_iscntrl(envVarValue[i]))