idx
int64
func_before
string
Vulnerability Classification
string
vul
int64
func_after
string
patch
string
CWE ID
string
lines_before
string
lines_after
string
21,700
invoke_NPN_SetProperty(PluginInstance *plugin, NPObject *npobj, NPIdentifier propertyName, const NPVariant *value) { npw_return_val_if_fail(rpc_method_invoke_possible(g_rpc_connection), false); int error = rpc_method_invoke(g_rpc_connection, RPC_METHOD_NPN_SET_PROPERTY, RPC_TYPE_NPW_PLUGIN_INSTANCE, plugin, RPC_TYPE_NP_OBJECT, npobj, RPC_TYPE_NP_IDENTIFIER, &propertyName, RPC_TYPE_NP_VARIANT, value, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_SetProperty() invoke", error); return false; } uint32_t ret; error = rpc_method_wait_for_reply(g_rpc_connection, RPC_TYPE_UINT32, &ret, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_SetProperty() wait for reply", error); return false; } return ret; }
Bypass
0
invoke_NPN_SetProperty(PluginInstance *plugin, NPObject *npobj, NPIdentifier propertyName, const NPVariant *value) { npw_return_val_if_fail(rpc_method_invoke_possible(g_rpc_connection), false); int error = rpc_method_invoke(g_rpc_connection, RPC_METHOD_NPN_SET_PROPERTY, RPC_TYPE_NPW_PLUGIN_INSTANCE, plugin, RPC_TYPE_NP_OBJECT, npobj, RPC_TYPE_NP_IDENTIFIER, &propertyName, RPC_TYPE_NP_VARIANT, value, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_SetProperty() invoke", error); return false; } uint32_t ret; error = rpc_method_wait_for_reply(g_rpc_connection, RPC_TYPE_UINT32, &ret, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_SetProperty() wait for reply", error); return false; } return ret; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,701
invoke_NPN_SetValue(PluginInstance *plugin, NPPVariable variable, void *value) { switch (rpc_type_of_NPPVariable(variable)) { case RPC_TYPE_BOOLEAN: break; default: D(bug("WARNING: unhandled variable %d in NPN_SetValue()\n", variable)); return NPERR_INVALID_PARAM; } npw_return_val_if_fail(rpc_method_invoke_possible(g_rpc_connection), NPERR_GENERIC_ERROR); int error = rpc_method_invoke(g_rpc_connection, RPC_METHOD_NPN_SET_VALUE, RPC_TYPE_NPW_PLUGIN_INSTANCE, plugin, RPC_TYPE_UINT32, variable, RPC_TYPE_BOOLEAN, (uint32_t)(uintptr_t)value, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_SetValue() invoke", error); return NPERR_GENERIC_ERROR; } int32_t ret; error = rpc_method_wait_for_reply(g_rpc_connection, RPC_TYPE_INT32, &ret, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_SetValue() wait for reply", error); return NPERR_GENERIC_ERROR; } return ret; }
Bypass
0
invoke_NPN_SetValue(PluginInstance *plugin, NPPVariable variable, void *value) { switch (rpc_type_of_NPPVariable(variable)) { case RPC_TYPE_BOOLEAN: break; default: D(bug("WARNING: unhandled variable %d in NPN_SetValue()\n", variable)); return NPERR_INVALID_PARAM; } npw_return_val_if_fail(rpc_method_invoke_possible(g_rpc_connection), NPERR_GENERIC_ERROR); int error = rpc_method_invoke(g_rpc_connection, RPC_METHOD_NPN_SET_VALUE, RPC_TYPE_NPW_PLUGIN_INSTANCE, plugin, RPC_TYPE_UINT32, variable, RPC_TYPE_BOOLEAN, (uint32_t)(uintptr_t)value, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_SetValue() invoke", error); return NPERR_GENERIC_ERROR; } int32_t ret; error = rpc_method_wait_for_reply(g_rpc_connection, RPC_TYPE_INT32, &ret, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_SetValue() wait for reply", error); return NPERR_GENERIC_ERROR; } return ret; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,702
invoke_NPN_Status(PluginInstance *plugin, const char *message) { npw_return_if_fail(rpc_method_invoke_possible(g_rpc_connection)); int error = rpc_method_invoke(g_rpc_connection, RPC_METHOD_NPN_STATUS, RPC_TYPE_NPW_PLUGIN_INSTANCE, plugin, RPC_TYPE_STRING, message, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_Status() invoke", error); return; } error = rpc_method_wait_for_reply(g_rpc_connection, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_Status() wait for reply", error); return; } }
Bypass
0
invoke_NPN_Status(PluginInstance *plugin, const char *message) { npw_return_if_fail(rpc_method_invoke_possible(g_rpc_connection)); int error = rpc_method_invoke(g_rpc_connection, RPC_METHOD_NPN_STATUS, RPC_TYPE_NPW_PLUGIN_INSTANCE, plugin, RPC_TYPE_STRING, message, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_Status() invoke", error); return; } error = rpc_method_wait_for_reply(g_rpc_connection, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_Status() wait for reply", error); return; } }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,703
invoke_NPN_UTF8FromIdentifier(NPIdentifier identifier) { npw_return_val_if_fail(rpc_method_invoke_possible(g_rpc_connection), NULL); int error = rpc_method_invoke(g_rpc_connection, RPC_METHOD_NPN_UTF8_FROM_IDENTIFIER, RPC_TYPE_NP_IDENTIFIER, &identifier, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_UTF8FromIdentifier() invoke", error); return NULL; } NPUTF8 *str; error = rpc_method_wait_for_reply(g_rpc_connection, RPC_TYPE_NP_UTF8, &str, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_UTF8FromIdentifier() wait for reply", error); return NULL; } return str; }
Bypass
0
invoke_NPN_UTF8FromIdentifier(NPIdentifier identifier) { npw_return_val_if_fail(rpc_method_invoke_possible(g_rpc_connection), NULL); int error = rpc_method_invoke(g_rpc_connection, RPC_METHOD_NPN_UTF8_FROM_IDENTIFIER, RPC_TYPE_NP_IDENTIFIER, &identifier, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_UTF8FromIdentifier() invoke", error); return NULL; } NPUTF8 *str; error = rpc_method_wait_for_reply(g_rpc_connection, RPC_TYPE_NP_UTF8, &str, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_UTF8FromIdentifier() wait for reply", error); return NULL; } return str; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,704
invoke_NPN_UserAgent(void) { npw_return_val_if_fail(rpc_method_invoke_possible(g_rpc_connection), NULL); int error = rpc_method_invoke(g_rpc_connection, RPC_METHOD_NPN_USER_AGENT, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_UserAgent() invoke", error); return NULL; } char *user_agent; error = rpc_method_wait_for_reply(g_rpc_connection, RPC_TYPE_STRING, &user_agent, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_UserAgent() wait for reply", error); return NULL; } return user_agent; }
Bypass
0
invoke_NPN_UserAgent(void) { npw_return_val_if_fail(rpc_method_invoke_possible(g_rpc_connection), NULL); int error = rpc_method_invoke(g_rpc_connection, RPC_METHOD_NPN_USER_AGENT, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_UserAgent() invoke", error); return NULL; } char *user_agent; error = rpc_method_wait_for_reply(g_rpc_connection, RPC_TYPE_STRING, &user_agent, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_UserAgent() wait for reply", error); return NULL; } return user_agent; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,705
invoke_NPN_Write(PluginInstance *plugin, NPStream *stream, int32_t len, void *buf) { npw_return_val_if_fail(rpc_method_invoke_possible(g_rpc_connection), -1); int error = rpc_method_invoke(g_rpc_connection, RPC_METHOD_NPN_WRITE, RPC_TYPE_NPW_PLUGIN_INSTANCE, plugin, RPC_TYPE_NP_STREAM, stream, RPC_TYPE_ARRAY, RPC_TYPE_CHAR, len, buf, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_Write() invoke", error); return -1; } int32_t ret; error = rpc_method_wait_for_reply(g_rpc_connection, RPC_TYPE_INT32, &ret, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_Write() wait for reply", error); return -1; } return ret; }
Bypass
0
invoke_NPN_Write(PluginInstance *plugin, NPStream *stream, int32_t len, void *buf) { npw_return_val_if_fail(rpc_method_invoke_possible(g_rpc_connection), -1); int error = rpc_method_invoke(g_rpc_connection, RPC_METHOD_NPN_WRITE, RPC_TYPE_NPW_PLUGIN_INSTANCE, plugin, RPC_TYPE_NP_STREAM, stream, RPC_TYPE_ARRAY, RPC_TYPE_CHAR, len, buf, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_Write() invoke", error); return -1; } int32_t ret; error = rpc_method_wait_for_reply(g_rpc_connection, RPC_TYPE_INT32, &ret, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_Write() wait for reply", error); return -1; } return ret; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,706
static inline bool is_thread_check_enabled(void) { static int thread_check = -1; if (thread_check < 0) thread_check = is_thread_check_enabled_1(); return thread_check; }
Bypass
0
static inline bool is_thread_check_enabled(void) { static int thread_check = -1; if (thread_check < 0) thread_check = is_thread_check_enabled_1(); return thread_check; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,707
static bool is_thread_check_enabled_1(void) { const char *thread_check_str; if ((thread_check_str = getenv("NPW_THREAD_CHECK")) != NULL) return ((strcmp(thread_check_str, "yes") == 0) || (strcmp(thread_check_str, "1") == 0)); /* enable main-thread checks by default for all builds from snapshots */ return NPW_SNAPSHOT > 0; }
Bypass
0
static bool is_thread_check_enabled_1(void) { const char *thread_check_str; if ((thread_check_str = getenv("NPW_THREAD_CHECK")) != NULL) return ((strcmp(thread_check_str, "yes") == 0) || (strcmp(thread_check_str, "1") == 0)); /* enable main-thread checks by default for all builds from snapshots */ return NPW_SNAPSHOT > 0; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,708
int main(int argc, char **argv) { const char *plugin_path = NULL; const char *connection_path = NULL; enum { CMD_RUN, CMD_TEST, CMD_INFO, CMD_HELP }; int cmd = CMD_RUN; for (int i = 0; i < argc; i++) { const char *arg = argv[i]; if (strcmp(arg, "-h") == 0 || strcmp(arg, "--help") == 0) { argv[i] = NULL; cmd = CMD_HELP; } else if (strcmp(arg, "-t") == 0 || strcmp(arg, "--test") == 0) { argv[i] = NULL; cmd = CMD_TEST; } else if (strcmp(arg, "-i") == 0 || strcmp(arg, "--info") == 0) { argv[i] = NULL; cmd = CMD_INFO; } else if (strcmp(arg, "-p") == 0 || strcmp(arg, "--plugin") == 0) { argv[i] = NULL; if (++i < argc) { plugin_path = argv[i]; argv[i] = NULL; } } else if (strcmp(arg, "-c") == 0 || strcmp(arg, "--connection") == 0) { argv[i] = NULL; if (++i < argc) { connection_path = argv[i]; argv[i] = NULL; } } } for (int i = 1, j = 1, n = argc; i < n; i++) { if (argv[i]) argv[j++] = argv[i]; else --argc; } void *handles[10] = { NULL, }; int n_handles = 0; if (plugin_path == NULL) cmd = CMD_HELP; else { void *handle; const char *error; #if defined(__sun) /* XXX: check for Flash Player only? */ const char SunStudio_libCrun[] = "libCrun.so.1"; D(bug(" trying to open SunStudio C++ runtime '%s'\n", SunStudio_libCrun)); if ((handle = dlopen(SunStudio_libCrun, RTLD_LAZY|RTLD_GLOBAL)) == NULL) { npw_printf("ERROR: %s\n", dlerror()); return 1; } handles[n_handles++] = handle; dlerror(); #endif D(bug(" %s\n", plugin_path)); if ((handle = dlopen(plugin_path, RTLD_LAZY)) == NULL) { npw_printf("ERROR: %s\n", dlerror()); return 1; } handles[n_handles++] = handle; dlerror(); g_plugin_NP_GetMIMEDescription = (NP_GetMIMEDescriptionUPP)dlsym(handle, "NP_GetMIMEDescription"); if ((error = dlerror()) != NULL) { npw_printf("ERROR: %s\n", error); return 1; } g_plugin_NP_Initialize = (NP_InitializeUPP)dlsym(handle, "NP_Initialize"); if ((error = dlerror()) != NULL) { npw_printf("ERROR: %s\n", error); return 1; } g_plugin_NP_Shutdown = (NP_ShutdownUPP)dlsym(handle, "NP_Shutdown"); if ((error = dlerror()) != NULL) { npw_printf("ERROR: %s\n", error); return 1; } g_plugin_NP_GetValue = (NP_GetValueUPP)dlsym(handle, "NP_GetValue"); } int ret = 1; switch (cmd) { case CMD_RUN: ret = do_main(argc, argv, connection_path); break; case CMD_TEST: ret = do_test(); break; case CMD_INFO: ret = do_info(); break; case CMD_HELP: ret = do_help(argv[0]); break; } while (--n_handles >= 0) { void * const handle = handles[n_handles]; if (handle) dlclose(handle); } return ret; }
Bypass
0
int main(int argc, char **argv) { const char *plugin_path = NULL; const char *connection_path = NULL; enum { CMD_RUN, CMD_TEST, CMD_INFO, CMD_HELP }; int cmd = CMD_RUN; for (int i = 0; i < argc; i++) { const char *arg = argv[i]; if (strcmp(arg, "-h") == 0 || strcmp(arg, "--help") == 0) { argv[i] = NULL; cmd = CMD_HELP; } else if (strcmp(arg, "-t") == 0 || strcmp(arg, "--test") == 0) { argv[i] = NULL; cmd = CMD_TEST; } else if (strcmp(arg, "-i") == 0 || strcmp(arg, "--info") == 0) { argv[i] = NULL; cmd = CMD_INFO; } else if (strcmp(arg, "-p") == 0 || strcmp(arg, "--plugin") == 0) { argv[i] = NULL; if (++i < argc) { plugin_path = argv[i]; argv[i] = NULL; } } else if (strcmp(arg, "-c") == 0 || strcmp(arg, "--connection") == 0) { argv[i] = NULL; if (++i < argc) { connection_path = argv[i]; argv[i] = NULL; } } } for (int i = 1, j = 1, n = argc; i < n; i++) { if (argv[i]) argv[j++] = argv[i]; else --argc; } void *handles[10] = { NULL, }; int n_handles = 0; if (plugin_path == NULL) cmd = CMD_HELP; else { void *handle; const char *error; #if defined(__sun) /* XXX: check for Flash Player only? */ const char SunStudio_libCrun[] = "libCrun.so.1"; D(bug(" trying to open SunStudio C++ runtime '%s'\n", SunStudio_libCrun)); if ((handle = dlopen(SunStudio_libCrun, RTLD_LAZY|RTLD_GLOBAL)) == NULL) { npw_printf("ERROR: %s\n", dlerror()); return 1; } handles[n_handles++] = handle; dlerror(); #endif D(bug(" %s\n", plugin_path)); if ((handle = dlopen(plugin_path, RTLD_LAZY)) == NULL) { npw_printf("ERROR: %s\n", dlerror()); return 1; } handles[n_handles++] = handle; dlerror(); g_plugin_NP_GetMIMEDescription = (NP_GetMIMEDescriptionUPP)dlsym(handle, "NP_GetMIMEDescription"); if ((error = dlerror()) != NULL) { npw_printf("ERROR: %s\n", error); return 1; } g_plugin_NP_Initialize = (NP_InitializeUPP)dlsym(handle, "NP_Initialize"); if ((error = dlerror()) != NULL) { npw_printf("ERROR: %s\n", error); return 1; } g_plugin_NP_Shutdown = (NP_ShutdownUPP)dlsym(handle, "NP_Shutdown"); if ((error = dlerror()) != NULL) { npw_printf("ERROR: %s\n", error); return 1; } g_plugin_NP_GetValue = (NP_GetValueUPP)dlsym(handle, "NP_GetValue"); } int ret = 1; switch (cmd) { case CMD_RUN: ret = do_main(argc, argv, connection_path); break; case CMD_TEST: ret = do_test(); break; case CMD_INFO: ret = do_info(); break; case CMD_HELP: ret = do_help(argv[0]); break; } while (--n_handles >= 0) { void * const handle = handles[n_handles]; if (handle) dlclose(handle); } return ret; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,709
static void npidentifier_cache_add_int(NPIdentifier ident, int32_t value) { if (G_UNLIKELY(g_npidentifier_cache == NULL)) return; NPIdentifierInfo *npi = npidentifier_info_new(); if (G_UNLIKELY(npi == NULL)) return; npi->string_len = 0; npi->u.value = value; g_hash_table_insert(g_npidentifier_cache, ident, npi); }
Bypass
0
static void npidentifier_cache_add_int(NPIdentifier ident, int32_t value) { if (G_UNLIKELY(g_npidentifier_cache == NULL)) return; NPIdentifierInfo *npi = npidentifier_info_new(); if (G_UNLIKELY(npi == NULL)) return; npi->string_len = 0; npi->u.value = value; g_hash_table_insert(g_npidentifier_cache, ident, npi); }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,710
static inline void npidentifier_cache_create(void) { g_npidentifier_cache = g_hash_table_new_full(NULL, NULL, NULL, (GDestroyNotify)npidentifier_info_destroy); }
Bypass
0
static inline void npidentifier_cache_create(void) { g_npidentifier_cache = g_hash_table_new_full(NULL, NULL, NULL, (GDestroyNotify)npidentifier_info_destroy); }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,711
static inline void npidentifier_cache_destroy(void) { if (g_npidentifier_cache) { g_hash_table_destroy(g_npidentifier_cache); g_npidentifier_cache = NULL; } }
Bypass
0
static inline void npidentifier_cache_destroy(void) { if (g_npidentifier_cache) { g_hash_table_destroy(g_npidentifier_cache); g_npidentifier_cache = NULL; } }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,712
static inline bool npidentifier_cache_find(NPIdentifierFindArgs *args, NPIdentifier *pident) { args->ident = NULL; #if defined(HAVE_G_HASH_TABLE_FIND) && !defined(BUILD_GENERIC) if (!g_hash_table_find(g_npidentifier_cache, npidentifier_cache_find_info, args)) return false; #else g_hash_table_foreach(g_npidentifier_cache, (GHFunc)npidentifier_cache_find_info, args); if (args->ident == NULL) return false; #endif if (pident) *pident = args->ident; return true; }
Bypass
0
static inline bool npidentifier_cache_find(NPIdentifierFindArgs *args, NPIdentifier *pident) { args->ident = NULL; #if defined(HAVE_G_HASH_TABLE_FIND) && !defined(BUILD_GENERIC) if (!g_hash_table_find(g_npidentifier_cache, npidentifier_cache_find_info, args)) return false; #else g_hash_table_foreach(g_npidentifier_cache, (GHFunc)npidentifier_cache_find_info, args); if (args->ident == NULL) return false; #endif if (pident) *pident = args->ident; return true; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,713
static gboolean npidentifier_cache_find_info(gpointer key, gpointer value, gpointer user_data) { NPIdentifier *ident = (NPIdentifier)key; NPIdentifierInfo *npi = (NPIdentifierInfo *)value; NPIdentifierFindArgs *args = (NPIdentifierFindArgs *)user_data; #if !defined(HAVE_G_HASH_TABLE_FIND) || defined(BUILD_GENERIC) if (args->ident) return FALSE; #endif if (npi->string_len != args->info.string_len) return FALSE; if (args->info.string_len > 0) { /* a string */ if (memcmp(args->info.u.string, npi->u.string, args->info.string_len) == 0) { args->ident = ident; return TRUE; } } else { /* an integer */ if (args->info.u.value == npi->u.value) { args->ident = ident; return TRUE; } } return FALSE; }
Bypass
0
static gboolean npidentifier_cache_find_info(gpointer key, gpointer value, gpointer user_data) { NPIdentifier *ident = (NPIdentifier)key; NPIdentifierInfo *npi = (NPIdentifierInfo *)value; NPIdentifierFindArgs *args = (NPIdentifierFindArgs *)user_data; #if !defined(HAVE_G_HASH_TABLE_FIND) || defined(BUILD_GENERIC) if (args->ident) return FALSE; #endif if (npi->string_len != args->info.string_len) return FALSE; if (args->info.string_len > 0) { /* a string */ if (memcmp(args->info.u.string, npi->u.string, args->info.string_len) == 0) { args->ident = ident; return TRUE; } } else { /* an integer */ if (args->info.u.value == npi->u.value) { args->ident = ident; return TRUE; } } return FALSE; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,714
static inline bool npidentifier_cache_has_string(const gchar *str, NPIdentifier *pident) { if (G_UNLIKELY(g_npidentifier_cache == NULL)) return false; NPIdentifierFindArgs args; args.info.string_len = strlen(str) + 1; args.info.u.string = (gchar *)str; return npidentifier_cache_find(&args, pident); }
Bypass
0
static inline bool npidentifier_cache_has_string(const gchar *str, NPIdentifier *pident) { if (G_UNLIKELY(g_npidentifier_cache == NULL)) return false; NPIdentifierFindArgs args; args.info.string_len = strlen(str) + 1; args.info.u.string = (gchar *)str; return npidentifier_cache_find(&args, pident); }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,715
static inline NPIdentifierInfo *npidentifier_cache_lookup(NPIdentifier ident) { if (G_UNLIKELY(g_npidentifier_cache == NULL)) return NULL; return g_hash_table_lookup(g_npidentifier_cache, ident); }
Bypass
0
static inline NPIdentifierInfo *npidentifier_cache_lookup(NPIdentifier ident) { if (G_UNLIKELY(g_npidentifier_cache == NULL)) return NULL; return g_hash_table_lookup(g_npidentifier_cache, ident); }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,716
static void npidentifier_cache_reserve(int n_entries) { if (G_UNLIKELY(g_npidentifier_cache == NULL)) npidentifier_cache_create(); if (g_hash_table_size(g_npidentifier_cache) + n_entries > NPIDENTIFIER_CACHE_SIZE) npidentifier_cache_invalidate(); }
Bypass
0
static void npidentifier_cache_reserve(int n_entries) { if (G_UNLIKELY(g_npidentifier_cache == NULL)) npidentifier_cache_create(); if (g_hash_table_size(g_npidentifier_cache) + n_entries > NPIDENTIFIER_CACHE_SIZE) npidentifier_cache_invalidate(); }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,717
static inline void npidentifier_info_destroy(NPIdentifierInfo *npi) { if (G_UNLIKELY(npi == NULL)) return; if (npi->string_len > 0) { NPW_MemFree(npi->u.string); npi->u.string = NULL; } NPW_MemFree(npi); }
Bypass
0
static inline void npidentifier_info_destroy(NPIdentifierInfo *npi) { if (G_UNLIKELY(npi == NULL)) return; if (npi->string_len > 0) { NPW_MemFree(npi->u.string); npi->u.string = NULL; } NPW_MemFree(npi); }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,718
static void plugin_instance_deallocate(PluginInstance *plugin) { NPW_MemFree(plugin); }
Bypass
0
static void plugin_instance_deallocate(PluginInstance *plugin) { NPW_MemFree(plugin); }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,719
static void plugin_instance_finalize(PluginInstance *plugin) { if (plugin->browser_toplevel) { g_object_unref(plugin->browser_toplevel); plugin->browser_toplevel = NULL; } if (plugin->instance) { free(plugin->instance); plugin->instance = NULL; } }
Bypass
0
static void plugin_instance_finalize(PluginInstance *plugin) { if (plugin->browser_toplevel) { g_object_unref(plugin->browser_toplevel); plugin->browser_toplevel = NULL; } if (plugin->instance) { free(plugin->instance); plugin->instance = NULL; } }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,720
static void plugin_instance_invalidate(PluginInstance *plugin) { destroy_window(plugin); /* NPP instance is no longer valid beyond this point. Drop the link to the PluginInstance now so that future RPC with this PluginInstance will actually emit a NULL instance, which the other side will deal as a no-op for all functions but NPN_GetValue(). However, don't free() the NPP instance yet as it could be used later, e.g. in some NPObject::Invalidate()... Note: this also means we forbid that function to call into the browser in an NPP instance. */ if (plugin->instance_id) { id_remove(plugin->instance_id); plugin->instance_id = 0; } }
Bypass
0
static void plugin_instance_invalidate(PluginInstance *plugin) { destroy_window(plugin); /* NPP instance is no longer valid beyond this point. Drop the link to the PluginInstance now so that future RPC with this PluginInstance will actually emit a NULL instance, which the other side will deal as a no-op for all functions but NPN_GetValue(). However, don't free() the NPP instance yet as it could be used later, e.g. in some NPObject::Invalidate()... Note: this also means we forbid that function to call into the browser in an NPP instance. */ if (plugin->instance_id) { id_remove(plugin->instance_id); plugin->instance_id = 0; } }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,721
static void rpc_error_callback_cb(rpc_connection_t *connection, void *user_data) { D(bug("RPC connection %p is in a bad state, closing the plugin\n",connection)); rpc_connection_set_error_callback(connection, NULL, NULL); gtk_main_quit(); }
Bypass
0
static void rpc_error_callback_cb(rpc_connection_t *connection, void *user_data) { D(bug("RPC connection %p is in a bad state, closing the plugin\n",connection)); rpc_connection_set_error_callback(connection, NULL, NULL); gtk_main_quit(); }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,722
static gboolean rpc_event_check(GSource *source) { return rpc_wait_dispatch(g_rpc_connection, 0) > 0; }
Bypass
0
static gboolean rpc_event_check(GSource *source) { return rpc_wait_dispatch(g_rpc_connection, 0) > 0; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,723
static gboolean rpc_event_dispatch(GSource *source, GSourceFunc callback, gpointer connection) { return rpc_dispatch(connection) != RPC_ERROR_CONNECTION_CLOSED; }
Bypass
0
static gboolean rpc_event_dispatch(GSource *source, GSourceFunc callback, gpointer connection) { return rpc_dispatch(connection) != RPC_ERROR_CONNECTION_CLOSED; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,724
static gboolean rpc_event_prepare(GSource *source, gint *timeout) { *timeout = -1; return FALSE; }
Bypass
0
static gboolean rpc_event_prepare(GSource *source, gint *timeout) { *timeout = -1; return FALSE; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,725
static void send_xembed_message(Display *display, Window window, long message, long detail, long data1, long data2) { XEvent xevent; memset(&xevent, 0, sizeof(xevent)); xevent.xclient.window = window; xevent.xclient.type = ClientMessage; xevent.xclient.message_type = XInternAtom(display, "_XEMBED", False); xevent.xclient.format = 32; xevent.xclient.data.l[0] = CurrentTime; // XXX: evil? xevent.xclient.data.l[1] = message; xevent.xclient.data.l[2] = detail; xevent.xclient.data.l[3] = data1; xevent.xclient.data.l[4] = data2; trap_errors(); XSendEvent(display, xevent.xclient.window, False, NoEventMask, &xevent); XSync(display, False); untrap_errors(); }
Bypass
0
static void send_xembed_message(Display *display, Window window, long message, long detail, long data1, long data2) { XEvent xevent; memset(&xevent, 0, sizeof(xevent)); xevent.xclient.window = window; xevent.xclient.type = ClientMessage; xevent.xclient.message_type = XInternAtom(display, "_XEMBED", False); xevent.xclient.format = 32; xevent.xclient.data.l[0] = CurrentTime; // XXX: evil? xevent.xclient.data.l[1] = message; xevent.xclient.data.l[2] = detail; xevent.xclient.data.l[3] = data1; xevent.xclient.data.l[4] = data2; trap_errors(); XSendEvent(display, xevent.xclient.window, False, NoEventMask, &xevent); XSync(display, False); untrap_errors(); }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,726
bool thread_check(void) { #ifdef ENABLE_THREAD_CHECK if (is_thread_check_enabled()) return (g_main_thread == pthread_self()); #endif return true; }
Bypass
0
bool thread_check(void) { #ifdef ENABLE_THREAD_CHECK if (is_thread_check_enabled()) return (g_main_thread == pthread_self()); #endif return true; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,727
static void thread_check_init(void) { g_main_thread = pthread_self(); }
Bypass
0
static void thread_check_init(void) { g_main_thread = pthread_self(); }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,728
static void trap_errors(void) { trapped_error_code = 0; old_error_handler = XSetErrorHandler(error_handler); }
Bypass
0
static void trap_errors(void) { trapped_error_code = 0; old_error_handler = XSetErrorHandler(error_handler); }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,729
static int untrap_errors(void) { XSetErrorHandler(old_error_handler); return trapped_error_code; }
Bypass
0
static int untrap_errors(void) { XSetErrorHandler(old_error_handler); return trapped_error_code; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,730
static int update_window(PluginInstance *plugin, NPWindow *window) { if (plugin->is_windowless) { npw_printf("ERROR: update_window() called for windowless plugin\n"); return -1; } if (window->ws_info == NULL) { npw_printf("ERROR: no window attributes for window %p\n", window->window); return -1; } NPSetWindowCallbackStruct *ws_info = plugin->window.ws_info; memcpy(ws_info, window->ws_info, sizeof(*ws_info)); create_window_attributes(ws_info); memcpy(&plugin->window.clipRect, &window->clipRect, sizeof(window->clipRect));; if (plugin->window.x != window->x || plugin->window.y != window->y) { plugin->window.x = window->x; plugin->window.y = window->y; } if (plugin->window.width != window->width || plugin->window.height != window->height) { plugin->window.width = window->width; plugin->window.height = window->height; if (plugin->toolkit_data) { if (plugin->use_xembed) { } else { XtData *toolkit = (XtData *)plugin->toolkit_data; if (toolkit->form) XtResizeWidget(toolkit->form, plugin->window.width, plugin->window.height, 0); if (toolkit->top_widget) XtResizeWidget(toolkit->top_widget, plugin->window.width, plugin->window.height, 0); } } } return 0; }
Bypass
0
static int update_window(PluginInstance *plugin, NPWindow *window) { if (plugin->is_windowless) { npw_printf("ERROR: update_window() called for windowless plugin\n"); return -1; } if (window->ws_info == NULL) { npw_printf("ERROR: no window attributes for window %p\n", window->window); return -1; } NPSetWindowCallbackStruct *ws_info = plugin->window.ws_info; memcpy(ws_info, window->ws_info, sizeof(*ws_info)); create_window_attributes(ws_info); memcpy(&plugin->window.clipRect, &window->clipRect, sizeof(window->clipRect));; if (plugin->window.x != window->x || plugin->window.y != window->y) { plugin->window.x = window->x; plugin->window.y = window->y; } if (plugin->window.width != window->width || plugin->window.height != window->height) { plugin->window.width = window->width; plugin->window.height = window->height; if (plugin->toolkit_data) { if (plugin->use_xembed) { } else { XtData *toolkit = (XtData *)plugin->toolkit_data; if (toolkit->form) XtResizeWidget(toolkit->form, plugin->window.width, plugin->window.height, 0); if (toolkit->top_widget) XtResizeWidget(toolkit->top_widget, plugin->window.width, plugin->window.height, 0); } } } return 0; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,731
static inline bool use_npidentifier_cache(void) { return USE_NPIDENTIFIER_CACHE && npruntime_use_cache(); }
Bypass
0
static inline bool use_npidentifier_cache(void) { return USE_NPIDENTIFIER_CACHE && npruntime_use_cache(); }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,732
static void xt_client_set_info(Widget w, unsigned long flags) { Atom atom_XEMBED_INFO = XInternAtom(x_display, "_XEMBED_INFO", False); unsigned long buffer[2]; buffer[1] = 0; /* Protocol version */ buffer[1] = flags; XChangeProperty(XtDisplay(w), XtWindow(w), atom_XEMBED_INFO, atom_XEMBED_INFO, 32, PropModeReplace, (unsigned char *)buffer, 2); }
Bypass
0
static void xt_client_set_info(Widget w, unsigned long flags) { Atom atom_XEMBED_INFO = XInternAtom(x_display, "_XEMBED_INFO", False); unsigned long buffer[2]; buffer[1] = 0; /* Protocol version */ buffer[1] = flags; XChangeProperty(XtDisplay(w), XtWindow(w), atom_XEMBED_INFO, atom_XEMBED_INFO, 32, PropModeReplace, (unsigned char *)buffer, 2); }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,733
static void xt_client_simulate_focus(Widget w, int type) { XEvent xevent; memset(&xevent, 0, sizeof(xevent)); xevent.xfocus.type = type; xevent.xfocus.window = XtWindow(w); xevent.xfocus.display = XtDisplay(w); xevent.xfocus.mode = NotifyNormal; xevent.xfocus.detail = NotifyAncestor; trap_errors(); XSendEvent(XtDisplay(w), xevent.xfocus.window, False, NoEventMask, &xevent); XSync(XtDisplay(w), False); untrap_errors(); }
Bypass
0
static void xt_client_simulate_focus(Widget w, int type) { XEvent xevent; memset(&xevent, 0, sizeof(xevent)); xevent.xfocus.type = type; xevent.xfocus.window = XtWindow(w); xevent.xfocus.display = XtDisplay(w); xevent.xfocus.mode = NotifyNormal; xevent.xfocus.detail = NotifyAncestor; trap_errors(); XSendEvent(XtDisplay(w), xevent.xfocus.window, False, NoEventMask, &xevent); XSync(XtDisplay(w), False); untrap_errors(); }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,734
static void xt_dummy_input_cb(XtPointer closure, int *source, XtInputId *id) { /* dummy function, never called */ npw_printf("ERROR: xt_dummy_input_cb() should never be called\n"); }
Bypass
0
static void xt_dummy_input_cb(XtPointer closure, int *source, XtInputId *id) { /* dummy function, never called */ npw_printf("ERROR: xt_dummy_input_cb() should never be called\n"); }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,735
static void xt_dummy_timeout_cb(XtPointer closure, XtIntervalId *id) { /* dummy function, never called */ npw_printf("ERROR: xt_dummy_timeout_cb() should never be called\n"); }
Bypass
0
static void xt_dummy_timeout_cb(XtPointer closure, XtIntervalId *id) { /* dummy function, never called */ npw_printf("ERROR: xt_dummy_timeout_cb() should never be called\n"); }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,736
static gboolean xt_event_check(GSource *source) { if (xt_event_poll_fd.revents & G_IO_IN) { int mask = XtAppPending(x_app_context); if (mask) return TRUE; } return FALSE; }
Bypass
0
static gboolean xt_event_check(GSource *source) { if (xt_event_poll_fd.revents & G_IO_IN) { int mask = XtAppPending(x_app_context); if (mask) return TRUE; } return FALSE; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,737
static gboolean xt_event_prepare(GSource *source, gint *timeout) { int mask = XtAppPending(x_app_context); if (mask) return TRUE; /* XXX: create new GPollFD for input sources? */ return (*timeout = xt_get_next_timeout(source)) == 0; }
Bypass
0
static gboolean xt_event_prepare(GSource *source, gint *timeout) { int mask = XtAppPending(x_app_context); if (mask) return TRUE; /* XXX: create new GPollFD for input sources? */ return (*timeout = xt_get_next_timeout(source)) == 0; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,738
static int xt_get_next_timeout(GSource *source) { static int has_compatible_appcontext = -1; if (has_compatible_appcontext < 0) { if ((has_compatible_appcontext = xt_has_compatible_appcontext()) == 0) npw_printf("WARNING: xt_get_next_timeout() is not optimizable\n"); } int timeout = XT_DEFAULT_TIMEOUT; if (has_compatible_appcontext) { int input_timeout, timer_timeout; /* Check there is any input source to process */ if (get_appcontext_input_count() > 0) input_timeout = XT_DEFAULT_TIMEOUT; else input_timeout = -1; /* Check there is any timer to process */ if (x_app_context->timerQueue == NULL) timer_timeout = -1; else { /* Determine delay to next timeout. Zero means timeout already expired */ struct timeval *next = &x_app_context->timerQueue->te_timer_value; GTimeVal now; int64_t diff; g_source_get_current_time(source, &now); if ((diff = (int64_t)next->tv_sec - (int64_t)now.tv_sec) < 0) timer_timeout = 0; else if ((diff = diff*1000 + ((int64_t)next->tv_usec - (int64_t)now.tv_usec)/1000) <= 0) timer_timeout = 0; else timer_timeout = diff; } if (input_timeout < 0) timeout = timer_timeout; else if (timer_timeout < 0) timeout = input_timeout; else timeout = MIN(input_timeout, timer_timeout); } return timeout; }
Bypass
0
static int xt_get_next_timeout(GSource *source) { static int has_compatible_appcontext = -1; if (has_compatible_appcontext < 0) { if ((has_compatible_appcontext = xt_has_compatible_appcontext()) == 0) npw_printf("WARNING: xt_get_next_timeout() is not optimizable\n"); } int timeout = XT_DEFAULT_TIMEOUT; if (has_compatible_appcontext) { int input_timeout, timer_timeout; /* Check there is any input source to process */ if (get_appcontext_input_count() > 0) input_timeout = XT_DEFAULT_TIMEOUT; else input_timeout = -1; /* Check there is any timer to process */ if (x_app_context->timerQueue == NULL) timer_timeout = -1; else { /* Determine delay to next timeout. Zero means timeout already expired */ struct timeval *next = &x_app_context->timerQueue->te_timer_value; GTimeVal now; int64_t diff; g_source_get_current_time(source, &now); if ((diff = (int64_t)next->tv_sec - (int64_t)now.tv_sec) < 0) timer_timeout = 0; else if ((diff = diff*1000 + ((int64_t)next->tv_usec - (int64_t)now.tv_usec)/1000) <= 0) timer_timeout = 0; else timer_timeout = diff; } if (input_timeout < 0) timeout = timer_timeout; else if (timer_timeout < 0) timeout = input_timeout; else timeout = MIN(input_timeout, timer_timeout); } return timeout; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,739
static int xt_has_compatible_appcontext(void) { return xt_has_compatible_appcontext_timerQueue(); }
Bypass
0
static int xt_has_compatible_appcontext(void) { return xt_has_compatible_appcontext_timerQueue(); }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,740
static int xt_has_compatible_appcontext_timerQueue(void) { int is_compatible; XtIntervalId id; TimerEventRec *tq, *tq_probe; /* Try to determine where is the pointer to the next allocated TimerEventRec. Besides, XtAppAddTimeOut() shall not have been called already because we want to be sure any (libXt internal) "free" TimerEventRec pointer cache is empty. */ tq = XtNew(TimerEventRec); XtFree((char *)tq); tq_probe = XtNew(TimerEventRec); XtFree((char *)tq_probe); if (tq != tq_probe) return 0; id = XtAppAddTimeOut(x_app_context, 0, xt_dummy_timeout_cb, GUINT_TO_POINTER(0xdeadbeef)); tq = x_app_context->timerQueue; is_compatible = tq == tq_probe && tq->app == x_app_context && tq->te_proc == xt_dummy_timeout_cb && tq->te_closure == GUINT_TO_POINTER(0xdeadbeef) ; XtRemoveTimeOut(id); return is_compatible; }
Bypass
0
static int xt_has_compatible_appcontext_timerQueue(void) { int is_compatible; XtIntervalId id; TimerEventRec *tq, *tq_probe; /* Try to determine where is the pointer to the next allocated TimerEventRec. Besides, XtAppAddTimeOut() shall not have been called already because we want to be sure any (libXt internal) "free" TimerEventRec pointer cache is empty. */ tq = XtNew(TimerEventRec); XtFree((char *)tq); tq_probe = XtNew(TimerEventRec); XtFree((char *)tq_probe); if (tq != tq_probe) return 0; id = XtAppAddTimeOut(x_app_context, 0, xt_dummy_timeout_cb, GUINT_TO_POINTER(0xdeadbeef)); tq = x_app_context->timerQueue; is_compatible = tq == tq_probe && tq->app == x_app_context && tq->te_proc == xt_dummy_timeout_cb && tq->te_closure == GUINT_TO_POINTER(0xdeadbeef) ; XtRemoveTimeOut(id); return is_compatible; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,741
static int xt_source_create(void) { if (++xt_source_count > 1 && xt_source != NULL) return 0; if ((xt_source = g_source_new(&xt_event_funcs, sizeof(GSource))) == NULL) { npw_printf("ERROR: failed to initialize Xt events listener\n"); return -1; } g_source_set_priority(xt_source, GDK_PRIORITY_EVENTS); g_source_set_can_recurse(xt_source, TRUE); g_source_attach(xt_source, NULL); xt_event_poll_fd.fd = ConnectionNumber(x_display); xt_event_poll_fd.events = G_IO_IN; xt_event_poll_fd.revents = 0; g_source_add_poll(xt_source, &xt_event_poll_fd); return 0; }
Bypass
0
static int xt_source_create(void) { if (++xt_source_count > 1 && xt_source != NULL) return 0; if ((xt_source = g_source_new(&xt_event_funcs, sizeof(GSource))) == NULL) { npw_printf("ERROR: failed to initialize Xt events listener\n"); return -1; } g_source_set_priority(xt_source, GDK_PRIORITY_EVENTS); g_source_set_can_recurse(xt_source, TRUE); g_source_attach(xt_source, NULL); xt_event_poll_fd.fd = ConnectionNumber(x_display); xt_event_poll_fd.events = G_IO_IN; xt_event_poll_fd.revents = 0; g_source_add_poll(xt_source, &xt_event_poll_fd); return 0; }
@@ -1302,6 +1302,8 @@ g_NPN_GetValue(NPP instance, NPNVariable variable, void *value) case NPNVSupportsXEmbedBool: case NPNVWindowNPObject: case NPNVPluginElementNPObject: + case NPNVprivateModeBool: + case NPNVsupportsAdvancedKeyHandling: return g_NPN_GetValue_real(instance, variable, value); default: switch (variable & 0xff) {
CWE-264
null
null
21,742
static int get_open_max(void) { int open_max = -1; /* SCO OpenServer has an fcntl() to retrieve the highest *currently open* file descriptor. */ #ifdef F_GETHFDO if ((open_max = fcntl(-1, F_GETHFDO, 0)) >= 0) return open_max + 1; #endif /* IEEE Std 1003.1-2001/Cor 1-2002 clarified the fact that return value of sysconf(_SC_OPEN_MAX) may change if setrlimit() was called to set RLIMIT_NOFILE. So, we should be on the safe side to call getrlimit() first to get the soft limit. Note: dgettablesize() was a possibility but (i) it's equivalent to getrlimit(), and (ii) it is not recommended for new code. */ struct rlimit ru; if (getrlimit(RLIMIT_NOFILE, &ru) == 0) return ru.rlim_cur; if ((open_max = sysconf(_SC_OPEN_MAX)) >= 0) return open_max; /* XXX: simply guess something reasonable. */ return 256; }
Bypass
0
static int get_open_max(void) { int open_max = -1; /* SCO OpenServer has an fcntl() to retrieve the highest *currently open* file descriptor. */ #ifdef F_GETHFDO if ((open_max = fcntl(-1, F_GETHFDO, 0)) >= 0) return open_max + 1; #endif /* IEEE Std 1003.1-2001/Cor 1-2002 clarified the fact that return value of sysconf(_SC_OPEN_MAX) may change if setrlimit() was called to set RLIMIT_NOFILE. So, we should be on the safe side to call getrlimit() first to get the soft limit. Note: dgettablesize() was a possibility but (i) it's equivalent to getrlimit(), and (ii) it is not recommended for new code. */ struct rlimit ru; if (getrlimit(RLIMIT_NOFILE, &ru) == 0) return ru.rlim_cur; if ((open_max = sysconf(_SC_OPEN_MAX)) >= 0) return open_max; /* XXX: simply guess something reasonable. */ return 256; }
@@ -247,6 +247,11 @@ const char *string_of_NPPVariable(int variable) _(NPPVpluginNeedsXEmbed); _(NPPVpluginScriptableNPObject); _(NPPVformValue); + _(NPPVpluginUrlRequestsDisplayedBool); + _(NPPVpluginWantsAllNetworkStreams); + _(NPPVpluginNativeAccessibleAtkPlugId); + _(NPPVpluginCancelSrcStream); + _(NPPVSupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) { @@ -283,6 +288,8 @@ const char *string_of_NPNVariable(int variable) _(NPNVWindowNPObject); _(NPNVPluginElementNPObject); _(NPNVSupportsWindowless); + _(NPNVprivateModeBool); + _(NPNVsupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) {
CWE-264
null
null
21,743
int id_create(void *ptr) { static int id = 0; id_link(++id, ptr); return id; }
Bypass
0
int id_create(void *ptr) { static int id = 0; id_link(++id, ptr); return id; }
@@ -247,6 +247,11 @@ const char *string_of_NPPVariable(int variable) _(NPPVpluginNeedsXEmbed); _(NPPVpluginScriptableNPObject); _(NPPVformValue); + _(NPPVpluginUrlRequestsDisplayedBool); + _(NPPVpluginWantsAllNetworkStreams); + _(NPPVpluginNativeAccessibleAtkPlugId); + _(NPPVpluginCancelSrcStream); + _(NPPVSupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) { @@ -283,6 +288,8 @@ const char *string_of_NPNVariable(int variable) _(NPNVWindowNPObject); _(NPNVPluginElementNPObject); _(NPNVSupportsWindowless); + _(NPNVprivateModeBool); + _(NPNVsupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) {
CWE-264
null
null
21,744
bool id_init(void) { if (g_ids == NULL) g_ids = g_hash_table_new(NULL, NULL); return g_ids != NULL; }
Bypass
0
bool id_init(void) { if (g_ids == NULL) g_ids = g_hash_table_new(NULL, NULL); return g_ids != NULL; }
@@ -247,6 +247,11 @@ const char *string_of_NPPVariable(int variable) _(NPPVpluginNeedsXEmbed); _(NPPVpluginScriptableNPObject); _(NPPVformValue); + _(NPPVpluginUrlRequestsDisplayedBool); + _(NPPVpluginWantsAllNetworkStreams); + _(NPPVpluginNativeAccessibleAtkPlugId); + _(NPPVpluginCancelSrcStream); + _(NPPVSupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) { @@ -283,6 +288,8 @@ const char *string_of_NPNVariable(int variable) _(NPNVWindowNPObject); _(NPNVPluginElementNPObject); _(NPNVSupportsWindowless); + _(NPNVprivateModeBool); + _(NPNVsupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) {
CWE-264
null
null
21,745
static inline void *id_key(uint32_t id) { return (void *)(uintptr_t)id; }
Bypass
0
static inline void *id_key(uint32_t id) { return (void *)(uintptr_t)id; }
@@ -247,6 +247,11 @@ const char *string_of_NPPVariable(int variable) _(NPPVpluginNeedsXEmbed); _(NPPVpluginScriptableNPObject); _(NPPVformValue); + _(NPPVpluginUrlRequestsDisplayedBool); + _(NPPVpluginWantsAllNetworkStreams); + _(NPPVpluginNativeAccessibleAtkPlugId); + _(NPPVpluginCancelSrcStream); + _(NPPVSupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) { @@ -283,6 +288,8 @@ const char *string_of_NPNVariable(int variable) _(NPNVWindowNPObject); _(NPNVPluginElementNPObject); _(NPNVSupportsWindowless); + _(NPNVprivateModeBool); + _(NPNVsupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) {
CWE-264
null
null
21,746
void id_link(int id, void *ptr) { g_hash_table_insert(g_ids, id_key(id), ptr); }
Bypass
0
void id_link(int id, void *ptr) { g_hash_table_insert(g_ids, id_key(id), ptr); }
@@ -247,6 +247,11 @@ const char *string_of_NPPVariable(int variable) _(NPPVpluginNeedsXEmbed); _(NPPVpluginScriptableNPObject); _(NPPVformValue); + _(NPPVpluginUrlRequestsDisplayedBool); + _(NPPVpluginWantsAllNetworkStreams); + _(NPPVpluginNativeAccessibleAtkPlugId); + _(NPPVpluginCancelSrcStream); + _(NPPVSupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) { @@ -283,6 +288,8 @@ const char *string_of_NPNVariable(int variable) _(NPNVWindowNPObject); _(NPNVPluginElementNPObject); _(NPNVSupportsWindowless); + _(NPNVprivateModeBool); + _(NPNVsupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) {
CWE-264
null
null
21,747
void *id_lookup(int id) { return g_hash_table_lookup(g_ids, id_key(id)); }
Bypass
0
void *id_lookup(int id) { return g_hash_table_lookup(g_ids, id_key(id)); }
@@ -247,6 +247,11 @@ const char *string_of_NPPVariable(int variable) _(NPPVpluginNeedsXEmbed); _(NPPVpluginScriptableNPObject); _(NPPVformValue); + _(NPPVpluginUrlRequestsDisplayedBool); + _(NPPVpluginWantsAllNetworkStreams); + _(NPPVpluginNativeAccessibleAtkPlugId); + _(NPPVpluginCancelSrcStream); + _(NPPVSupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) { @@ -283,6 +288,8 @@ const char *string_of_NPNVariable(int variable) _(NPNVWindowNPObject); _(NPNVPluginElementNPObject); _(NPNVSupportsWindowless); + _(NPNVprivateModeBool); + _(NPNVsupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) {
CWE-264
null
null
21,748
int id_lookup_value(void *ptr) { return g_hash_table_find(g_ids, id_match_value, &ptr) ? (uintptr_t)ptr : -1; }
Bypass
0
int id_lookup_value(void *ptr) { return g_hash_table_find(g_ids, id_match_value, &ptr) ? (uintptr_t)ptr : -1; }
@@ -247,6 +247,11 @@ const char *string_of_NPPVariable(int variable) _(NPPVpluginNeedsXEmbed); _(NPPVpluginScriptableNPObject); _(NPPVformValue); + _(NPPVpluginUrlRequestsDisplayedBool); + _(NPPVpluginWantsAllNetworkStreams); + _(NPPVpluginNativeAccessibleAtkPlugId); + _(NPPVpluginCancelSrcStream); + _(NPPVSupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) { @@ -283,6 +288,8 @@ const char *string_of_NPNVariable(int variable) _(NPNVWindowNPObject); _(NPNVPluginElementNPObject); _(NPNVSupportsWindowless); + _(NPNVprivateModeBool); + _(NPNVsupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) {
CWE-264
null
null
21,749
static gboolean id_match_value(gpointer key, gpointer value, gpointer user_data) { if (value == *(gpointer *)user_data) { *(int *)user_data = (uintptr_t)key; return true; } return false; }
Bypass
0
static gboolean id_match_value(gpointer key, gpointer value, gpointer user_data) { if (value == *(gpointer *)user_data) { *(int *)user_data = (uintptr_t)key; return true; } return false; }
@@ -247,6 +247,11 @@ const char *string_of_NPPVariable(int variable) _(NPPVpluginNeedsXEmbed); _(NPPVpluginScriptableNPObject); _(NPPVformValue); + _(NPPVpluginUrlRequestsDisplayedBool); + _(NPPVpluginWantsAllNetworkStreams); + _(NPPVpluginNativeAccessibleAtkPlugId); + _(NPPVpluginCancelSrcStream); + _(NPPVSupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) { @@ -283,6 +288,8 @@ const char *string_of_NPNVariable(int variable) _(NPNVWindowNPObject); _(NPNVPluginElementNPObject); _(NPNVSupportsWindowless); + _(NPNVprivateModeBool); + _(NPNVsupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) {
CWE-264
null
null
21,750
bool id_remove(int id) { return g_hash_table_remove(g_ids, id_key(id)); }
Bypass
0
bool id_remove(int id) { return g_hash_table_remove(g_ids, id_key(id)); }
@@ -247,6 +247,11 @@ const char *string_of_NPPVariable(int variable) _(NPPVpluginNeedsXEmbed); _(NPPVpluginScriptableNPObject); _(NPPVformValue); + _(NPPVpluginUrlRequestsDisplayedBool); + _(NPPVpluginWantsAllNetworkStreams); + _(NPPVpluginNativeAccessibleAtkPlugId); + _(NPPVpluginCancelSrcStream); + _(NPPVSupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) { @@ -283,6 +288,8 @@ const char *string_of_NPNVariable(int variable) _(NPNVWindowNPObject); _(NPNVPluginElementNPObject); _(NPNVSupportsWindowless); + _(NPNVprivateModeBool); + _(NPNVsupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) {
CWE-264
null
null
21,751
int main(void) { char *str; int i, id; id_init(); #define N_CELLS_PER_SLOT 8 #define N_STRINGS ((2 * N_CELLS_PER_SLOT) + 3) char *strings[N_STRINGS]; int ids[N_STRINGS]; for (i = 0; i < N_STRINGS; i++) { str = malloc(10); sprintf(str, "%d", i); strings[i] = str; id = id_create(str); if (id < 0) { fprintf(stderr, "ERROR: failed to allocate ID for '%s'\n", str); return 1; } ids[i] = id; } id = ids[N_CELLS_PER_SLOT / 2]; str = id_lookup(id); printf("str(%d) : '%s'\n", id, str); id = ids[N_CELLS_PER_SLOT]; if (id_remove(id) < 0) { fprintf(stderr, "ERROR: failed to unlink ID %d\n", id); return 1; } ids[N_CELLS_PER_SLOT] = 0; for (i = 0; i < N_CELLS_PER_SLOT; i++) { id = ids[N_CELLS_PER_SLOT + i]; if (id && id_remove(id) < 0) { fprintf(stderr, "ERROR: failed to unlink ID %d from slot 1\n", id); return 1; } ids[N_CELLS_PER_SLOT + i] = 0; } id = ids[2 * N_CELLS_PER_SLOT]; str = id_lookup(id); printf("str(%d) : '%s'\n", id, str); for (i = 0; i < N_STRINGS; i++) { id = ids[i]; if (id && id_remove(id) < 0) { fprintf(stderr, "ERROR: failed to unlink ID %d for final cleanup\n", id); return 1; } } for (i = 0; i < N_STRINGS; i++) free(strings[i]); id_kill(); return 0; }
Bypass
0
int main(void) { char *str; int i, id; id_init(); #define N_CELLS_PER_SLOT 8 #define N_STRINGS ((2 * N_CELLS_PER_SLOT) + 3) char *strings[N_STRINGS]; int ids[N_STRINGS]; for (i = 0; i < N_STRINGS; i++) { str = malloc(10); sprintf(str, "%d", i); strings[i] = str; id = id_create(str); if (id < 0) { fprintf(stderr, "ERROR: failed to allocate ID for '%s'\n", str); return 1; } ids[i] = id; } id = ids[N_CELLS_PER_SLOT / 2]; str = id_lookup(id); printf("str(%d) : '%s'\n", id, str); id = ids[N_CELLS_PER_SLOT]; if (id_remove(id) < 0) { fprintf(stderr, "ERROR: failed to unlink ID %d\n", id); return 1; } ids[N_CELLS_PER_SLOT] = 0; for (i = 0; i < N_CELLS_PER_SLOT; i++) { id = ids[N_CELLS_PER_SLOT + i]; if (id && id_remove(id) < 0) { fprintf(stderr, "ERROR: failed to unlink ID %d from slot 1\n", id); return 1; } ids[N_CELLS_PER_SLOT + i] = 0; } id = ids[2 * N_CELLS_PER_SLOT]; str = id_lookup(id); printf("str(%d) : '%s'\n", id, str); for (i = 0; i < N_STRINGS; i++) { id = ids[i]; if (id && id_remove(id) < 0) { fprintf(stderr, "ERROR: failed to unlink ID %d for final cleanup\n", id); return 1; } } for (i = 0; i < N_STRINGS; i++) free(strings[i]); id_kill(); return 0; }
@@ -247,6 +247,11 @@ const char *string_of_NPPVariable(int variable) _(NPPVpluginNeedsXEmbed); _(NPPVpluginScriptableNPObject); _(NPPVformValue); + _(NPPVpluginUrlRequestsDisplayedBool); + _(NPPVpluginWantsAllNetworkStreams); + _(NPPVpluginNativeAccessibleAtkPlugId); + _(NPPVpluginCancelSrcStream); + _(NPPVSupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) { @@ -283,6 +288,8 @@ const char *string_of_NPNVariable(int variable) _(NPNVWindowNPObject); _(NPNVPluginElementNPObject); _(NPNVSupportsWindowless); + _(NPNVprivateModeBool); + _(NPNVsupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) {
CWE-264
null
null
21,752
char *npw_asprintf(const char *format, ...) { va_list args; va_start(args, format); int alen = vsnprintf(NULL, 0, format, args); va_end(args); char *str = malloc(alen+1); if (str == NULL) return NULL; va_start(args, format); int rlen = vsnprintf(str, alen+1, format, args); va_end(args); if (rlen != alen) { free(str); return NULL; } return str; }
Bypass
0
char *npw_asprintf(const char *format, ...) { va_list args; va_start(args, format); int alen = vsnprintf(NULL, 0, format, args); va_end(args); char *str = malloc(alen+1); if (str == NULL) return NULL; va_start(args, format); int rlen = vsnprintf(str, alen+1, format, args); va_end(args); if (rlen != alen) { free(str); return NULL; } return str; }
@@ -247,6 +247,11 @@ const char *string_of_NPPVariable(int variable) _(NPPVpluginNeedsXEmbed); _(NPPVpluginScriptableNPObject); _(NPPVformValue); + _(NPPVpluginUrlRequestsDisplayedBool); + _(NPPVpluginWantsAllNetworkStreams); + _(NPPVpluginNativeAccessibleAtkPlugId); + _(NPPVpluginCancelSrcStream); + _(NPPVSupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) { @@ -283,6 +288,8 @@ const char *string_of_NPNVariable(int variable) _(NPNVWindowNPObject); _(NPNVPluginElementNPObject); _(NPNVSupportsWindowless); + _(NPNVprivateModeBool); + _(NPNVsupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) {
CWE-264
null
null
21,753
void npw_perror(const char *prefix, int error) { if (prefix && *prefix) npw_printf("ERROR: %s: %s\n", prefix, npw_strerror(error)); else npw_printf("ERROR: %s\n", npw_strerror(error)); }
Bypass
0
void npw_perror(const char *prefix, int error) { if (prefix && *prefix) npw_printf("ERROR: %s: %s\n", prefix, npw_strerror(error)); else npw_printf("ERROR: %s\n", npw_strerror(error)); }
@@ -247,6 +247,11 @@ const char *string_of_NPPVariable(int variable) _(NPPVpluginNeedsXEmbed); _(NPPVpluginScriptableNPObject); _(NPPVformValue); + _(NPPVpluginUrlRequestsDisplayedBool); + _(NPPVpluginWantsAllNetworkStreams); + _(NPPVpluginNativeAccessibleAtkPlugId); + _(NPPVpluginCancelSrcStream); + _(NPPVSupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) { @@ -283,6 +288,8 @@ const char *string_of_NPNVariable(int variable) _(NPNVWindowNPObject); _(NPNVPluginElementNPObject); _(NPNVSupportsWindowless); + _(NPNVprivateModeBool); + _(NPNVsupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) {
CWE-264
null
null
21,754
const char *npw_strerror(int error) { if (error > -1100 && error <= -1000) // RPC errors return rpc_strerror(error); switch (error) { case 0: return "No error"; } return "Unknown error"; }
Bypass
0
const char *npw_strerror(int error) { if (error > -1100 && error <= -1000) // RPC errors return rpc_strerror(error); switch (error) { case 0: return "No error"; } return "Unknown error"; }
@@ -247,6 +247,11 @@ const char *string_of_NPPVariable(int variable) _(NPPVpluginNeedsXEmbed); _(NPPVpluginScriptableNPObject); _(NPPVformValue); + _(NPPVpluginUrlRequestsDisplayedBool); + _(NPPVpluginWantsAllNetworkStreams); + _(NPPVpluginNativeAccessibleAtkPlugId); + _(NPPVpluginCancelSrcStream); + _(NPPVSupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) { @@ -283,6 +288,8 @@ const char *string_of_NPNVariable(int variable) _(NPNVWindowNPObject); _(NPNVPluginElementNPObject); _(NPNVSupportsWindowless); + _(NPNVprivateModeBool); + _(NPNVsupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) {
CWE-264
null
null
21,755
const char *string_of_NPError(int error) { const char *str; switch ((NPError)error) { #define _(VAL) case VAL: str = #VAL; break; _(NPERR_NO_ERROR); _(NPERR_GENERIC_ERROR); _(NPERR_INVALID_INSTANCE_ERROR); _(NPERR_INVALID_FUNCTABLE_ERROR); _(NPERR_MODULE_LOAD_FAILED_ERROR); _(NPERR_OUT_OF_MEMORY_ERROR); _(NPERR_INVALID_PLUGIN_ERROR); _(NPERR_INVALID_PLUGIN_DIR_ERROR); _(NPERR_INCOMPATIBLE_VERSION_ERROR); _(NPERR_INVALID_PARAM); _(NPERR_INVALID_URL); _(NPERR_FILE_NOT_FOUND); _(NPERR_NO_DATA); _(NPERR_STREAM_NOT_SEEKABLE); #undef _ default: str = "<unknown error>"; break; } return str; }
Bypass
0
const char *string_of_NPError(int error) { const char *str; switch ((NPError)error) { #define _(VAL) case VAL: str = #VAL; break; _(NPERR_NO_ERROR); _(NPERR_GENERIC_ERROR); _(NPERR_INVALID_INSTANCE_ERROR); _(NPERR_INVALID_FUNCTABLE_ERROR); _(NPERR_MODULE_LOAD_FAILED_ERROR); _(NPERR_OUT_OF_MEMORY_ERROR); _(NPERR_INVALID_PLUGIN_ERROR); _(NPERR_INVALID_PLUGIN_DIR_ERROR); _(NPERR_INCOMPATIBLE_VERSION_ERROR); _(NPERR_INVALID_PARAM); _(NPERR_INVALID_URL); _(NPERR_FILE_NOT_FOUND); _(NPERR_NO_DATA); _(NPERR_STREAM_NOT_SEEKABLE); #undef _ default: str = "<unknown error>"; break; } return str; }
@@ -247,6 +247,11 @@ const char *string_of_NPPVariable(int variable) _(NPPVpluginNeedsXEmbed); _(NPPVpluginScriptableNPObject); _(NPPVformValue); + _(NPPVpluginUrlRequestsDisplayedBool); + _(NPPVpluginWantsAllNetworkStreams); + _(NPPVpluginNativeAccessibleAtkPlugId); + _(NPPVpluginCancelSrcStream); + _(NPPVSupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) { @@ -283,6 +288,8 @@ const char *string_of_NPNVariable(int variable) _(NPNVWindowNPObject); _(NPNVPluginElementNPObject); _(NPNVSupportsWindowless); + _(NPNVprivateModeBool); + _(NPNVsupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) {
CWE-264
null
null
21,756
const char *string_of_NPReason(int reason) { const char *str; switch ((NPReason)reason) { #define _(VAL) case VAL: str = #VAL; break; _(NPRES_DONE); _(NPRES_NETWORK_ERR); _(NPRES_USER_BREAK); #undef _ default: str = "<unknown reason>"; break; } return str; }
Bypass
0
const char *string_of_NPReason(int reason) { const char *str; switch ((NPReason)reason) { #define _(VAL) case VAL: str = #VAL; break; _(NPRES_DONE); _(NPRES_NETWORK_ERR); _(NPRES_USER_BREAK); #undef _ default: str = "<unknown reason>"; break; } return str; }
@@ -247,6 +247,11 @@ const char *string_of_NPPVariable(int variable) _(NPPVpluginNeedsXEmbed); _(NPPVpluginScriptableNPObject); _(NPPVformValue); + _(NPPVpluginUrlRequestsDisplayedBool); + _(NPPVpluginWantsAllNetworkStreams); + _(NPPVpluginNativeAccessibleAtkPlugId); + _(NPPVpluginCancelSrcStream); + _(NPPVSupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) { @@ -283,6 +288,8 @@ const char *string_of_NPNVariable(int variable) _(NPNVWindowNPObject); _(NPNVPluginElementNPObject); _(NPNVSupportsWindowless); + _(NPNVprivateModeBool); + _(NPNVsupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) {
CWE-264
null
null
21,757
const char *string_of_NPStreamType(int stype) { const char *str; switch (stype) { #define _(VAL) case VAL: str = #VAL; break; _(NP_NORMAL); _(NP_SEEK); _(NP_ASFILE); _(NP_ASFILEONLY); #undef _ default: str = "<unknown stream type>"; break; } return str; }
Bypass
0
const char *string_of_NPStreamType(int stype) { const char *str; switch (stype) { #define _(VAL) case VAL: str = #VAL; break; _(NP_NORMAL); _(NP_SEEK); _(NP_ASFILE); _(NP_ASFILEONLY); #undef _ default: str = "<unknown stream type>"; break; } return str; }
@@ -247,6 +247,11 @@ const char *string_of_NPPVariable(int variable) _(NPPVpluginNeedsXEmbed); _(NPPVpluginScriptableNPObject); _(NPPVformValue); + _(NPPVpluginUrlRequestsDisplayedBool); + _(NPPVpluginWantsAllNetworkStreams); + _(NPPVpluginNativeAccessibleAtkPlugId); + _(NPPVpluginCancelSrcStream); + _(NPPVSupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) { @@ -283,6 +288,8 @@ const char *string_of_NPNVariable(int variable) _(NPNVWindowNPObject); _(NPNVPluginElementNPObject); _(NPNVSupportsWindowless); + _(NPNVprivateModeBool); + _(NPNVsupportsAdvancedKeyHandling); #undef _ default: switch (variable & 0xff) {
CWE-264
null
null
21,758
SYSCALL_DEFINE0(getpagesize) { return PAGE_SIZE; }
+Priv
0
SYSCALL_DEFINE0(getpagesize) { return PAGE_SIZE; }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,759
SYSCALL_DEFINE1(osf_brk, unsigned long, brk) { unsigned long retval = sys_brk(brk); if (brk && brk != retval) retval = -ENOMEM; return retval; }
+Priv
0
SYSCALL_DEFINE1(osf_brk, unsigned long, brk) { unsigned long retval = sys_brk(brk); if (brk && brk != retval) retval = -ENOMEM; return retval; }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,760
SYSCALL_DEFINE2(osf_proplist_syscall, enum pl_code, code, union pl_args __user *, args) { long error; int __user *min_buf_size_ptr; switch (code) { case PL_SET: if (get_user(error, &args->set.nbytes)) error = -EFAULT; break; case PL_FSET: if (get_user(error, &args->fset.nbytes)) error = -EFAULT; break; case PL_GET: error = get_user(min_buf_size_ptr, &args->get.min_buf_size); if (error) break; error = put_user(0, min_buf_size_ptr); break; case PL_FGET: error = get_user(min_buf_size_ptr, &args->fget.min_buf_size); if (error) break; error = put_user(0, min_buf_size_ptr); break; case PL_DEL: case PL_FDEL: error = 0; break; default: error = -EOPNOTSUPP; break; }; return error; }
+Priv
0
SYSCALL_DEFINE2(osf_proplist_syscall, enum pl_code, code, union pl_args __user *, args) { long error; int __user *min_buf_size_ptr; switch (code) { case PL_SET: if (get_user(error, &args->set.nbytes)) error = -EFAULT; break; case PL_FSET: if (get_user(error, &args->fset.nbytes)) error = -EFAULT; break; case PL_GET: error = get_user(min_buf_size_ptr, &args->get.min_buf_size); if (error) break; error = put_user(0, min_buf_size_ptr); break; case PL_FGET: error = get_user(min_buf_size_ptr, &args->fget.min_buf_size); if (error) break; error = put_user(0, min_buf_size_ptr); break; case PL_DEL: case PL_FDEL: error = 0; break; default: error = -EOPNOTSUPP; break; }; return error; }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,761
SYSCALL_DEFINE2(osf_sigstack, struct sigstack __user *, uss, struct sigstack __user *, uoss) { unsigned long usp = rdusp(); unsigned long oss_sp = current->sas_ss_sp + current->sas_ss_size; unsigned long oss_os = on_sig_stack(usp); int error; if (uss) { void __user *ss_sp; error = -EFAULT; if (get_user(ss_sp, &uss->ss_sp)) goto out; /* If the current stack was set with sigaltstack, don't swap stacks while we are on it. */ error = -EPERM; if (current->sas_ss_sp && on_sig_stack(usp)) goto out; /* Since we don't know the extent of the stack, and we don't track onstack-ness, but rather calculate it, we must presume a size. Ho hum this interface is lossy. */ current->sas_ss_sp = (unsigned long)ss_sp - SIGSTKSZ; current->sas_ss_size = SIGSTKSZ; } if (uoss) { error = -EFAULT; if (! access_ok(VERIFY_WRITE, uoss, sizeof(*uoss)) || __put_user(oss_sp, &uoss->ss_sp) || __put_user(oss_os, &uoss->ss_onstack)) goto out; } error = 0; out: return error; }
+Priv
0
SYSCALL_DEFINE2(osf_sigstack, struct sigstack __user *, uss, struct sigstack __user *, uoss) { unsigned long usp = rdusp(); unsigned long oss_sp = current->sas_ss_sp + current->sas_ss_size; unsigned long oss_os = on_sig_stack(usp); int error; if (uss) { void __user *ss_sp; error = -EFAULT; if (get_user(ss_sp, &uss->ss_sp)) goto out; /* If the current stack was set with sigaltstack, don't swap stacks while we are on it. */ error = -EPERM; if (current->sas_ss_sp && on_sig_stack(usp)) goto out; /* Since we don't know the extent of the stack, and we don't track onstack-ness, but rather calculate it, we must presume a size. Ho hum this interface is lossy. */ current->sas_ss_sp = (unsigned long)ss_sp - SIGSTKSZ; current->sas_ss_size = SIGSTKSZ; } if (uoss) { error = -EFAULT; if (! access_ok(VERIFY_WRITE, uoss, sizeof(*uoss)) || __put_user(oss_sp, &uoss->ss_sp) || __put_user(oss_os, &uoss->ss_onstack)) goto out; } error = 0; out: return error; }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,762
SYSCALL_DEFINE2(osf_settimeofday, struct timeval32 __user *, tv, struct timezone __user *, tz) { struct timespec kts; struct timezone ktz; if (tv) { if (get_tv32((struct timeval *)&kts, tv)) return -EFAULT; } if (tz) { if (copy_from_user(&ktz, tz, sizeof(*tz))) return -EFAULT; } kts.tv_nsec *= 1000; return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); }
+Priv
0
SYSCALL_DEFINE2(osf_settimeofday, struct timeval32 __user *, tv, struct timezone __user *, tz) { struct timespec kts; struct timezone ktz; if (tv) { if (get_tv32((struct timeval *)&kts, tv)) return -EFAULT; } if (tz) { if (copy_from_user(&ktz, tz, sizeof(*tz))) return -EFAULT; } kts.tv_nsec *= 1000; return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,763
SYSCALL_DEFINE2(osf_getitimer, int, which, struct itimerval32 __user *, it) { struct itimerval kit; int error; error = do_getitimer(which, &kit); if (!error && put_it32(it, &kit)) error = -EFAULT; return error; }
+Priv
0
SYSCALL_DEFINE2(osf_getitimer, int, which, struct itimerval32 __user *, it) { struct itimerval kit; int error; error = do_getitimer(which, &kit); if (!error && put_it32(it, &kit)) error = -EFAULT; return error; }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,764
SYSCALL_DEFINE2(osf_utimes, const char __user *, filename, struct timeval32 __user *, tvs) { struct timespec tv[2]; if (tvs) { struct timeval ktvs[2]; if (get_tv32(&ktvs[0], &tvs[0]) || get_tv32(&ktvs[1], &tvs[1])) return -EFAULT; if (ktvs[0].tv_usec < 0 || ktvs[0].tv_usec >= 1000000 || ktvs[1].tv_usec < 0 || ktvs[1].tv_usec >= 1000000) return -EINVAL; tv[0].tv_sec = ktvs[0].tv_sec; tv[0].tv_nsec = 1000 * ktvs[0].tv_usec; tv[1].tv_sec = ktvs[1].tv_sec; tv[1].tv_nsec = 1000 * ktvs[1].tv_usec; } return do_utimes(AT_FDCWD, filename, tvs ? tv : NULL, 0); }
+Priv
0
SYSCALL_DEFINE2(osf_utimes, const char __user *, filename, struct timeval32 __user *, tvs) { struct timespec tv[2]; if (tvs) { struct timeval ktvs[2]; if (get_tv32(&ktvs[0], &tvs[0]) || get_tv32(&ktvs[1], &tvs[1])) return -EFAULT; if (ktvs[0].tv_usec < 0 || ktvs[0].tv_usec >= 1000000 || ktvs[1].tv_usec < 0 || ktvs[1].tv_usec >= 1000000) return -EINVAL; tv[0].tv_sec = ktvs[0].tv_sec; tv[0].tv_nsec = 1000 * ktvs[0].tv_usec; tv[1].tv_sec = ktvs[1].tv_sec; tv[1].tv_nsec = 1000 * ktvs[1].tv_usec; } return do_utimes(AT_FDCWD, filename, tvs ? tv : NULL, 0); }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,765
SYSCALL_DEFINE2(osf_getrusage, int, who, struct rusage32 __user *, ru) { struct rusage32 r; if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN) return -EINVAL; memset(&r, 0, sizeof(r)); switch (who) { case RUSAGE_SELF: jiffies_to_timeval32(current->utime, &r.ru_utime); jiffies_to_timeval32(current->stime, &r.ru_stime); r.ru_minflt = current->min_flt; r.ru_majflt = current->maj_flt; break; case RUSAGE_CHILDREN: jiffies_to_timeval32(current->signal->cutime, &r.ru_utime); jiffies_to_timeval32(current->signal->cstime, &r.ru_stime); r.ru_minflt = current->signal->cmin_flt; r.ru_majflt = current->signal->cmaj_flt; break; } return copy_to_user(ru, &r, sizeof(r)) ? -EFAULT : 0; }
+Priv
0
SYSCALL_DEFINE2(osf_getrusage, int, who, struct rusage32 __user *, ru) { struct rusage32 r; if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN) return -EINVAL; memset(&r, 0, sizeof(r)); switch (who) { case RUSAGE_SELF: jiffies_to_timeval32(current->utime, &r.ru_utime); jiffies_to_timeval32(current->stime, &r.ru_stime); r.ru_minflt = current->min_flt; r.ru_majflt = current->maj_flt; break; case RUSAGE_CHILDREN: jiffies_to_timeval32(current->signal->cutime, &r.ru_utime); jiffies_to_timeval32(current->signal->cstime, &r.ru_stime); r.ru_minflt = current->signal->cmin_flt; r.ru_majflt = current->signal->cmaj_flt; break; } return copy_to_user(ru, &r, sizeof(r)) ? -EFAULT : 0; }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,766
SYSCALL_DEFINE2(osf_usleep_thread, struct timeval32 __user *, sleep, struct timeval32 __user *, remain) { struct timeval tmp; unsigned long ticks; if (get_tv32(&tmp, sleep)) goto fault; ticks = timeval_to_jiffies(&tmp); ticks = schedule_timeout_interruptible(ticks); if (remain) { jiffies_to_timeval(ticks, &tmp); if (put_tv32(remain, &tmp)) goto fault; } return 0; fault: return -EFAULT; }
+Priv
0
SYSCALL_DEFINE2(osf_usleep_thread, struct timeval32 __user *, sleep, struct timeval32 __user *, remain) { struct timeval tmp; unsigned long ticks; if (get_tv32(&tmp, sleep)) goto fault; ticks = timeval_to_jiffies(&tmp); ticks = schedule_timeout_interruptible(ticks); if (remain) { jiffies_to_timeval(ticks, &tmp); if (put_tv32(remain, &tmp)) goto fault; } return 0; fault: return -EFAULT; }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,767
SYSCALL_DEFINE3(osf_statfs, const char __user *, pathname, struct osf_statfs __user *, buffer, unsigned long, bufsiz) { struct kstatfs linux_stat; int error = user_statfs(pathname, &linux_stat); if (!error) error = linux_to_osf_statfs(&linux_stat, buffer, bufsiz); return error; }
+Priv
0
SYSCALL_DEFINE3(osf_statfs, const char __user *, pathname, struct osf_statfs __user *, buffer, unsigned long, bufsiz) { struct kstatfs linux_stat; int error = user_statfs(pathname, &linux_stat); if (!error) error = linux_to_osf_statfs(&linux_stat, buffer, bufsiz); return error; }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,768
SYSCALL_DEFINE3(osf_fstatfs, unsigned long, fd, struct osf_statfs __user *, buffer, unsigned long, bufsiz) { struct kstatfs linux_stat; int error = fd_statfs(fd, &linux_stat); if (!error) error = linux_to_osf_statfs(&linux_stat, buffer, bufsiz); return error; }
+Priv
0
SYSCALL_DEFINE3(osf_fstatfs, unsigned long, fd, struct osf_statfs __user *, buffer, unsigned long, bufsiz) { struct kstatfs linux_stat; int error = fd_statfs(fd, &linux_stat); if (!error) error = linux_to_osf_statfs(&linux_stat, buffer, bufsiz); return error; }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,769
SYSCALL_DEFINE3(osf_setitimer, int, which, struct itimerval32 __user *, in, struct itimerval32 __user *, out) { struct itimerval kin, kout; int error; if (in) { if (get_it32(&kin, in)) return -EFAULT; } else memset(&kin, 0, sizeof(kin)); error = do_setitimer(which, &kin, out ? &kout : NULL); if (error || !out) return error; if (put_it32(out, &kout)) return -EFAULT; return 0; }
+Priv
0
SYSCALL_DEFINE3(osf_setitimer, int, which, struct itimerval32 __user *, in, struct itimerval32 __user *, out) { struct itimerval kin, kout; int error; if (in) { if (get_it32(&kin, in)) return -EFAULT; } else memset(&kin, 0, sizeof(kin)); error = do_setitimer(which, &kin, out ? &kout : NULL); if (error || !out) return error; if (put_it32(out, &kout)) return -EFAULT; return 0; }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,770
SYSCALL_DEFINE3(osf_writev, unsigned long, fd, const struct iovec __user *, vector, unsigned long, count) { if (unlikely(personality(current->personality) == PER_OSF4)) if (osf_fix_iov_len(vector, count)) return -EFAULT; return sys_writev(fd, vector, count); }
+Priv
0
SYSCALL_DEFINE3(osf_writev, unsigned long, fd, const struct iovec __user *, vector, unsigned long, count) { if (unlikely(personality(current->personality) == PER_OSF4)) if (osf_fix_iov_len(vector, count)) return -EFAULT; return sys_writev(fd, vector, count); }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,771
SYSCALL_DEFINE4(osf_set_program_attributes, unsigned long, text_start, unsigned long, text_len, unsigned long, bss_start, unsigned long, bss_len) { struct mm_struct *mm; mm = current->mm; mm->end_code = bss_start + bss_len; mm->start_brk = bss_start + bss_len; mm->brk = bss_start + bss_len; #if 0 printk("set_program_attributes(%lx %lx %lx %lx)\n", text_start, text_len, bss_start, bss_len); #endif return 0; }
+Priv
0
SYSCALL_DEFINE4(osf_set_program_attributes, unsigned long, text_start, unsigned long, text_len, unsigned long, bss_start, unsigned long, bss_len) { struct mm_struct *mm; mm = current->mm; mm->end_code = bss_start + bss_len; mm->start_brk = bss_start + bss_len; mm->brk = bss_start + bss_len; #if 0 printk("set_program_attributes(%lx %lx %lx %lx)\n", text_start, text_len, bss_start, bss_len); #endif return 0; }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,772
SYSCALL_DEFINE5(osf_setsysinfo, unsigned long, op, void __user *, buffer, unsigned long, nbytes, int __user *, start, void __user *, arg) { switch (op) { case SSI_IEEE_FP_CONTROL: { unsigned long swcr, fpcr; unsigned int *state; /* * Alpha Architecture Handbook 4.7.7.3: * To be fully IEEE compiant, we must track the current IEEE * exception state in software, because spurious bits can be * set in the trap shadow of a software-complete insn. */ if (get_user(swcr, (unsigned long __user *)buffer)) return -EFAULT; state = &current_thread_info()->ieee_state; /* Update softare trap enable bits. */ *state = (*state & ~IEEE_SW_MASK) | (swcr & IEEE_SW_MASK); /* Update the real fpcr. */ fpcr = rdfpcr() & FPCR_DYN_MASK; fpcr |= ieee_swcr_to_fpcr(swcr); wrfpcr(fpcr); return 0; } case SSI_IEEE_RAISE_EXCEPTION: { unsigned long exc, swcr, fpcr, fex; unsigned int *state; if (get_user(exc, (unsigned long __user *)buffer)) return -EFAULT; state = &current_thread_info()->ieee_state; exc &= IEEE_STATUS_MASK; /* Update softare trap enable bits. */ swcr = (*state & IEEE_SW_MASK) | exc; *state |= exc; /* Update the real fpcr. */ fpcr = rdfpcr(); fpcr |= ieee_swcr_to_fpcr(swcr); wrfpcr(fpcr); /* If any exceptions set by this call, and are unmasked, send a signal. Old exceptions are not signaled. */ fex = (exc >> IEEE_STATUS_TO_EXCSUM_SHIFT) & swcr; if (fex) { siginfo_t info; int si_code = 0; if (fex & IEEE_TRAP_ENABLE_DNO) si_code = FPE_FLTUND; if (fex & IEEE_TRAP_ENABLE_INE) si_code = FPE_FLTRES; if (fex & IEEE_TRAP_ENABLE_UNF) si_code = FPE_FLTUND; if (fex & IEEE_TRAP_ENABLE_OVF) si_code = FPE_FLTOVF; if (fex & IEEE_TRAP_ENABLE_DZE) si_code = FPE_FLTDIV; if (fex & IEEE_TRAP_ENABLE_INV) si_code = FPE_FLTINV; info.si_signo = SIGFPE; info.si_errno = 0; info.si_code = si_code; info.si_addr = NULL; /* FIXME */ send_sig_info(SIGFPE, &info, current); } return 0; } case SSI_IEEE_STATE_AT_SIGNAL: case SSI_IEEE_IGNORE_STATE_AT_SIGNAL: /* * Not sure anybody will ever use this weird stuff. These * ops can be used (under OSF/1) to set the fpcr that should * be used when a signal handler starts executing. */ break; case SSI_NVPAIRS: { unsigned long v, w, i; unsigned int old, new; for (i = 0; i < nbytes; ++i) { if (get_user(v, 2*i + (unsigned int __user *)buffer)) return -EFAULT; if (get_user(w, 2*i + 1 + (unsigned int __user *)buffer)) return -EFAULT; switch (v) { case SSIN_UACPROC: again: old = current_thread_info()->flags; new = old & ~(UAC_BITMASK << UAC_SHIFT); new = new | (w & UAC_BITMASK) << UAC_SHIFT; if (cmpxchg(&current_thread_info()->flags, old, new) != old) goto again; break; default: return -EOPNOTSUPP; } } return 0; } default: break; } return -EOPNOTSUPP; }
+Priv
0
SYSCALL_DEFINE5(osf_setsysinfo, unsigned long, op, void __user *, buffer, unsigned long, nbytes, int __user *, start, void __user *, arg) { switch (op) { case SSI_IEEE_FP_CONTROL: { unsigned long swcr, fpcr; unsigned int *state; /* * Alpha Architecture Handbook 4.7.7.3: * To be fully IEEE compiant, we must track the current IEEE * exception state in software, because spurious bits can be * set in the trap shadow of a software-complete insn. */ if (get_user(swcr, (unsigned long __user *)buffer)) return -EFAULT; state = &current_thread_info()->ieee_state; /* Update softare trap enable bits. */ *state = (*state & ~IEEE_SW_MASK) | (swcr & IEEE_SW_MASK); /* Update the real fpcr. */ fpcr = rdfpcr() & FPCR_DYN_MASK; fpcr |= ieee_swcr_to_fpcr(swcr); wrfpcr(fpcr); return 0; } case SSI_IEEE_RAISE_EXCEPTION: { unsigned long exc, swcr, fpcr, fex; unsigned int *state; if (get_user(exc, (unsigned long __user *)buffer)) return -EFAULT; state = &current_thread_info()->ieee_state; exc &= IEEE_STATUS_MASK; /* Update softare trap enable bits. */ swcr = (*state & IEEE_SW_MASK) | exc; *state |= exc; /* Update the real fpcr. */ fpcr = rdfpcr(); fpcr |= ieee_swcr_to_fpcr(swcr); wrfpcr(fpcr); /* If any exceptions set by this call, and are unmasked, send a signal. Old exceptions are not signaled. */ fex = (exc >> IEEE_STATUS_TO_EXCSUM_SHIFT) & swcr; if (fex) { siginfo_t info; int si_code = 0; if (fex & IEEE_TRAP_ENABLE_DNO) si_code = FPE_FLTUND; if (fex & IEEE_TRAP_ENABLE_INE) si_code = FPE_FLTRES; if (fex & IEEE_TRAP_ENABLE_UNF) si_code = FPE_FLTUND; if (fex & IEEE_TRAP_ENABLE_OVF) si_code = FPE_FLTOVF; if (fex & IEEE_TRAP_ENABLE_DZE) si_code = FPE_FLTDIV; if (fex & IEEE_TRAP_ENABLE_INV) si_code = FPE_FLTINV; info.si_signo = SIGFPE; info.si_errno = 0; info.si_code = si_code; info.si_addr = NULL; /* FIXME */ send_sig_info(SIGFPE, &info, current); } return 0; } case SSI_IEEE_STATE_AT_SIGNAL: case SSI_IEEE_IGNORE_STATE_AT_SIGNAL: /* * Not sure anybody will ever use this weird stuff. These * ops can be used (under OSF/1) to set the fpcr that should * be used when a signal handler starts executing. */ break; case SSI_NVPAIRS: { unsigned long v, w, i; unsigned int old, new; for (i = 0; i < nbytes; ++i) { if (get_user(v, 2*i + (unsigned int __user *)buffer)) return -EFAULT; if (get_user(w, 2*i + 1 + (unsigned int __user *)buffer)) return -EFAULT; switch (v) { case SSIN_UACPROC: again: old = current_thread_info()->flags; new = old & ~(UAC_BITMASK << UAC_SHIFT); new = new | (w & UAC_BITMASK) << UAC_SHIFT; if (cmpxchg(&current_thread_info()->flags, old, new) != old) goto again; break; default: return -EOPNOTSUPP; } } return 0; } default: break; } return -EOPNOTSUPP; }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,773
SYSCALL_DEFINE5(osf_select, int, n, fd_set __user *, inp, fd_set __user *, outp, fd_set __user *, exp, struct timeval32 __user *, tvp) { struct timespec end_time, *to = NULL; if (tvp) { time_t sec, usec; to = &end_time; if (!access_ok(VERIFY_READ, tvp, sizeof(*tvp)) || __get_user(sec, &tvp->tv_sec) || __get_user(usec, &tvp->tv_usec)) { return -EFAULT; } if (sec < 0 || usec < 0) return -EINVAL; if (poll_select_set_timeout(to, sec, usec * NSEC_PER_USEC)) return -EINVAL; } /* OSF does not copy back the remaining time. */ return core_sys_select(n, inp, outp, exp, to); }
+Priv
0
SYSCALL_DEFINE5(osf_select, int, n, fd_set __user *, inp, fd_set __user *, outp, fd_set __user *, exp, struct timeval32 __user *, tvp) { struct timespec end_time, *to = NULL; if (tvp) { time_t sec, usec; to = &end_time; if (!access_ok(VERIFY_READ, tvp, sizeof(*tvp)) || __get_user(sec, &tvp->tv_sec) || __get_user(usec, &tvp->tv_usec)) { return -EFAULT; } if (sec < 0 || usec < 0) return -EINVAL; if (poll_select_set_timeout(to, sec, usec * NSEC_PER_USEC)) return -EINVAL; } /* OSF does not copy back the remaining time. */ return core_sys_select(n, inp, outp, exp, to); }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,774
SYSCALL_DEFINE6(osf_mmap, unsigned long, addr, unsigned long, len, unsigned long, prot, unsigned long, flags, unsigned long, fd, unsigned long, off) { unsigned long ret = -EINVAL; #if 0 if (flags & (_MAP_HASSEMAPHORE | _MAP_INHERIT | _MAP_UNALIGNED)) printk("%s: unimplemented OSF mmap flags %04lx\n", current->comm, flags); #endif if ((off + PAGE_ALIGN(len)) < off) goto out; if (off & ~PAGE_MASK) goto out; ret = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT); out: return ret; }
+Priv
0
SYSCALL_DEFINE6(osf_mmap, unsigned long, addr, unsigned long, len, unsigned long, prot, unsigned long, flags, unsigned long, fd, unsigned long, off) { unsigned long ret = -EINVAL; #if 0 if (flags & (_MAP_HASSEMAPHORE | _MAP_INHERIT | _MAP_UNALIGNED)) printk("%s: unimplemented OSF mmap flags %04lx\n", current->comm, flags); #endif if ((off + PAGE_ALIGN(len)) < off) goto out; if (off & ~PAGE_MASK) goto out; ret = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT); out: return ret; }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,775
arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { unsigned long limit; /* "32 bit" actually means 31 bit, since pointers sign extend. */ if (current->personality & ADDR_LIMIT_32BIT) limit = 0x80000000; else limit = TASK_SIZE; if (len > limit) return -ENOMEM; if (flags & MAP_FIXED) return addr; /* First, see if the given suggestion fits. The OSF/1 loader (/sbin/loader) relies on us returning an address larger than the requested if one exists, which is a terribly broken way to program. That said, I can see the use in being able to suggest not merely specific addresses, but regions of memory -- perhaps this feature should be incorporated into all ports? */ if (addr) { addr = arch_get_unmapped_area_1 (PAGE_ALIGN(addr), len, limit); if (addr != (unsigned long) -ENOMEM) return addr; } /* Next, try allocating at TASK_UNMAPPED_BASE. */ addr = arch_get_unmapped_area_1 (PAGE_ALIGN(TASK_UNMAPPED_BASE), len, limit); if (addr != (unsigned long) -ENOMEM) return addr; /* Finally, try allocating in low memory. */ addr = arch_get_unmapped_area_1 (PAGE_SIZE, len, limit); return addr; }
+Priv
0
arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { unsigned long limit; /* "32 bit" actually means 31 bit, since pointers sign extend. */ if (current->personality & ADDR_LIMIT_32BIT) limit = 0x80000000; else limit = TASK_SIZE; if (len > limit) return -ENOMEM; if (flags & MAP_FIXED) return addr; /* First, see if the given suggestion fits. The OSF/1 loader (/sbin/loader) relies on us returning an address larger than the requested if one exists, which is a terribly broken way to program. That said, I can see the use in being able to suggest not merely specific addresses, but regions of memory -- perhaps this feature should be incorporated into all ports? */ if (addr) { addr = arch_get_unmapped_area_1 (PAGE_ALIGN(addr), len, limit); if (addr != (unsigned long) -ENOMEM) return addr; } /* Next, try allocating at TASK_UNMAPPED_BASE. */ addr = arch_get_unmapped_area_1 (PAGE_ALIGN(TASK_UNMAPPED_BASE), len, limit); if (addr != (unsigned long) -ENOMEM) return addr; /* Finally, try allocating in low memory. */ addr = arch_get_unmapped_area_1 (PAGE_SIZE, len, limit); return addr; }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,776
arch_get_unmapped_area_1(unsigned long addr, unsigned long len, unsigned long limit) { struct vm_area_struct *vma = find_vma(current->mm, addr); while (1) { /* At this point: (!vma || addr < vma->vm_end). */ if (limit - len < addr) return -ENOMEM; if (!vma || addr + len <= vma->vm_start) return addr; addr = vma->vm_end; vma = vma->vm_next; } }
+Priv
0
arch_get_unmapped_area_1(unsigned long addr, unsigned long len, unsigned long limit) { struct vm_area_struct *vma = find_vma(current->mm, addr); while (1) { /* At this point: (!vma || addr < vma->vm_end). */ if (limit - len < addr) return -ENOMEM; if (!vma || addr + len <= vma->vm_start) return addr; addr = vma->vm_end; vma = vma->vm_next; } }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,777
get_tv32(struct timeval *o, struct timeval32 __user *i) { return (!access_ok(VERIFY_READ, i, sizeof(*i)) || (__get_user(o->tv_sec, &i->tv_sec) | __get_user(o->tv_usec, &i->tv_usec))); }
+Priv
0
get_tv32(struct timeval *o, struct timeval32 __user *i) { return (!access_ok(VERIFY_READ, i, sizeof(*i)) || (__get_user(o->tv_sec, &i->tv_sec) | __get_user(o->tv_usec, &i->tv_usec))); }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,778
jiffies_to_timeval32(unsigned long jiffies, struct timeval32 *value) { value->tv_usec = (jiffies % HZ) * (1000000L / HZ); value->tv_sec = jiffies / HZ; }
+Priv
0
jiffies_to_timeval32(unsigned long jiffies, struct timeval32 *value) { value->tv_usec = (jiffies % HZ) * (1000000L / HZ); value->tv_sec = jiffies / HZ; }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,779
linux_to_osf_statfs(struct kstatfs *linux_stat, struct osf_statfs __user *osf_stat, unsigned long bufsiz) { struct osf_statfs tmp_stat; tmp_stat.f_type = linux_stat->f_type; tmp_stat.f_flags = 0; /* mount flags */ tmp_stat.f_fsize = linux_stat->f_frsize; tmp_stat.f_bsize = linux_stat->f_bsize; tmp_stat.f_blocks = linux_stat->f_blocks; tmp_stat.f_bfree = linux_stat->f_bfree; tmp_stat.f_bavail = linux_stat->f_bavail; tmp_stat.f_files = linux_stat->f_files; tmp_stat.f_ffree = linux_stat->f_ffree; tmp_stat.f_fsid = linux_stat->f_fsid; if (bufsiz > sizeof(tmp_stat)) bufsiz = sizeof(tmp_stat); return copy_to_user(osf_stat, &tmp_stat, bufsiz) ? -EFAULT : 0; }
+Priv
0
linux_to_osf_statfs(struct kstatfs *linux_stat, struct osf_statfs __user *osf_stat, unsigned long bufsiz) { struct osf_statfs tmp_stat; tmp_stat.f_type = linux_stat->f_type; tmp_stat.f_flags = 0; /* mount flags */ tmp_stat.f_fsize = linux_stat->f_frsize; tmp_stat.f_bsize = linux_stat->f_bsize; tmp_stat.f_blocks = linux_stat->f_blocks; tmp_stat.f_bfree = linux_stat->f_bfree; tmp_stat.f_bavail = linux_stat->f_bavail; tmp_stat.f_files = linux_stat->f_files; tmp_stat.f_ffree = linux_stat->f_ffree; tmp_stat.f_fsid = linux_stat->f_fsid; if (bufsiz > sizeof(tmp_stat)) bufsiz = sizeof(tmp_stat); return copy_to_user(osf_stat, &tmp_stat, bufsiz) ? -EFAULT : 0; }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,780
osf_filldir(void *__buf, const char *name, int namlen, loff_t offset, u64 ino, unsigned int d_type) { struct osf_dirent __user *dirent; struct osf_dirent_callback *buf = (struct osf_dirent_callback *) __buf; unsigned int reclen = ALIGN(NAME_OFFSET + namlen + 1, sizeof(u32)); unsigned int d_ino; buf->error = -EINVAL; /* only used if we fail */ if (reclen > buf->count) return -EINVAL; d_ino = ino; if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) { buf->error = -EOVERFLOW; return -EOVERFLOW; } if (buf->basep) { if (put_user(offset, buf->basep)) goto Efault; buf->basep = NULL; } dirent = buf->dirent; if (put_user(d_ino, &dirent->d_ino) || put_user(namlen, &dirent->d_namlen) || put_user(reclen, &dirent->d_reclen) || copy_to_user(dirent->d_name, name, namlen) || put_user(0, dirent->d_name + namlen)) goto Efault; dirent = (void __user *)dirent + reclen; buf->dirent = dirent; buf->count -= reclen; return 0; Efault: buf->error = -EFAULT; return -EFAULT; }
+Priv
0
osf_filldir(void *__buf, const char *name, int namlen, loff_t offset, u64 ino, unsigned int d_type) { struct osf_dirent __user *dirent; struct osf_dirent_callback *buf = (struct osf_dirent_callback *) __buf; unsigned int reclen = ALIGN(NAME_OFFSET + namlen + 1, sizeof(u32)); unsigned int d_ino; buf->error = -EINVAL; /* only used if we fail */ if (reclen > buf->count) return -EINVAL; d_ino = ino; if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) { buf->error = -EOVERFLOW; return -EOVERFLOW; } if (buf->basep) { if (put_user(offset, buf->basep)) goto Efault; buf->basep = NULL; } dirent = buf->dirent; if (put_user(d_ino, &dirent->d_ino) || put_user(namlen, &dirent->d_namlen) || put_user(reclen, &dirent->d_reclen) || copy_to_user(dirent->d_name, name, namlen) || put_user(0, dirent->d_name + namlen)) goto Efault; dirent = (void __user *)dirent + reclen; buf->dirent = dirent; buf->count -= reclen; return 0; Efault: buf->error = -EFAULT; return -EFAULT; }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,781
osf_fix_iov_len(const struct iovec __user *iov, unsigned long count) { unsigned long i; for (i = 0 ; i < count ; i++) { int __user *iov_len_high = (int __user *)&iov[i].iov_len + 1; if (put_user(0, iov_len_high)) return -EFAULT; } return 0; }
+Priv
0
osf_fix_iov_len(const struct iovec __user *iov, unsigned long count) { unsigned long i; for (i = 0 ; i < count ; i++) { int __user *iov_len_high = (int __user *)&iov[i].iov_len + 1; if (put_user(0, iov_len_high)) return -EFAULT; } return 0; }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,782
osf_procfs_mount(char *dirname, struct procfs_args __user *args, int flags) { struct procfs_args tmp; if (copy_from_user(&tmp, args, sizeof(tmp))) return -EFAULT; return do_mount("", dirname, "proc", flags, NULL); }
+Priv
0
osf_procfs_mount(char *dirname, struct procfs_args __user *args, int flags) { struct procfs_args tmp; if (copy_from_user(&tmp, args, sizeof(tmp))) return -EFAULT; return do_mount("", dirname, "proc", flags, NULL); }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,783
osf_ufs_mount(char *dirname, struct ufs_args __user *args, int flags) { int retval; struct cdfs_args tmp; char *devname; retval = -EFAULT; if (copy_from_user(&tmp, args, sizeof(tmp))) goto out; devname = getname(tmp.devname); retval = PTR_ERR(devname); if (IS_ERR(devname)) goto out; retval = do_mount(devname, dirname, "ext2", flags, NULL); putname(devname); out: return retval; }
+Priv
0
osf_ufs_mount(char *dirname, struct ufs_args __user *args, int flags) { int retval; struct cdfs_args tmp; char *devname; retval = -EFAULT; if (copy_from_user(&tmp, args, sizeof(tmp))) goto out; devname = getname(tmp.devname); retval = PTR_ERR(devname); if (IS_ERR(devname)) goto out; retval = do_mount(devname, dirname, "ext2", flags, NULL); putname(devname); out: return retval; }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,784
put_it32(struct itimerval32 __user *o, struct itimerval *i) { return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) || (__put_user(i->it_interval.tv_sec, &o->it_interval.tv_sec) | __put_user(i->it_interval.tv_usec, &o->it_interval.tv_usec) | __put_user(i->it_value.tv_sec, &o->it_value.tv_sec) | __put_user(i->it_value.tv_usec, &o->it_value.tv_usec))); }
+Priv
0
put_it32(struct itimerval32 __user *o, struct itimerval *i) { return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) || (__put_user(i->it_interval.tv_sec, &o->it_interval.tv_sec) | __put_user(i->it_interval.tv_usec, &o->it_interval.tv_usec) | __put_user(i->it_value.tv_sec, &o->it_value.tv_sec) | __put_user(i->it_value.tv_usec, &o->it_value.tv_usec))); }
@@ -409,7 +409,7 @@ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) return -EFAULT; len = namelen; - if (namelen > 32) + if (len > 32) len = 32; down_read(&uts_sem); @@ -594,7 +594,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) down_read(&uts_sem); res = sysinfo_table[offset]; len = strlen(res)+1; - if (len > count) + if ((unsigned long)len > (unsigned long)count) len = count; if (copy_to_user(buf, res, len)) err = -EFAULT; @@ -649,7 +649,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, return 1; case GSI_GET_HWRPB: - if (nbytes < sizeof(*hwrpb)) + if (nbytes > sizeof(*hwrpb)) return -EINVAL; if (copy_to_user(buffer, hwrpb, nbytes) != 0) return -EFAULT; @@ -1008,6 +1008,7 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, { struct rusage r; long ret, err; + unsigned int status = 0; mm_segment_t old_fs; if (!ur) @@ -1016,13 +1017,15 @@ SYSCALL_DEFINE4(osf_wait4, pid_t, pid, int __user *, ustatus, int, options, old_fs = get_fs(); set_fs (KERNEL_DS); - ret = sys_wait4(pid, ustatus, options, (struct rusage __user *) &r); + ret = sys_wait4(pid, (unsigned int __user *) &status, options, + (struct rusage __user *) &r); set_fs (old_fs); if (!access_ok(VERIFY_WRITE, ur, sizeof(*ur))) return -EFAULT; err = 0; + err |= put_user(status, ustatus); err |= __put_user(r.ru_utime.tv_sec, &ur->ru_utime.tv_sec); err |= __put_user(r.ru_utime.tv_usec, &ur->ru_utime.tv_usec); err |= __put_user(r.ru_stime.tv_sec, &ur->ru_stime.tv_sec);
CWE-264
null
null
21,785
int __ksm_enter(struct mm_struct *mm) { struct mm_slot *mm_slot; int needs_wakeup; mm_slot = alloc_mm_slot(); if (!mm_slot) return -ENOMEM; /* Check ksm_run too? Would need tighter locking */ needs_wakeup = list_empty(&ksm_mm_head.mm_list); spin_lock(&ksm_mmlist_lock); insert_to_mm_slots_hash(mm, mm_slot); /* * Insert just behind the scanning cursor, to let the area settle * down a little; when fork is followed by immediate exec, we don't * want ksmd to waste time setting up and tearing down an rmap_list. */ list_add_tail(&mm_slot->mm_list, &ksm_scan.mm_slot->mm_list); spin_unlock(&ksm_mmlist_lock); set_bit(MMF_VM_MERGEABLE, &mm->flags); atomic_inc(&mm->mm_count); if (needs_wakeup) wake_up_interruptible(&ksm_thread_wait); return 0; }
DoS
0
int __ksm_enter(struct mm_struct *mm) { struct mm_slot *mm_slot; int needs_wakeup; mm_slot = alloc_mm_slot(); if (!mm_slot) return -ENOMEM; /* Check ksm_run too? Would need tighter locking */ needs_wakeup = list_empty(&ksm_mm_head.mm_list); spin_lock(&ksm_mmlist_lock); insert_to_mm_slots_hash(mm, mm_slot); /* * Insert just behind the scanning cursor, to let the area settle * down a little; when fork is followed by immediate exec, we don't * want ksmd to waste time setting up and tearing down an rmap_list. */ list_add_tail(&mm_slot->mm_list, &ksm_scan.mm_slot->mm_list); spin_unlock(&ksm_mmlist_lock); set_bit(MMF_VM_MERGEABLE, &mm->flags); atomic_inc(&mm->mm_count); if (needs_wakeup) wake_up_interruptible(&ksm_thread_wait); return 0; }
@@ -1302,6 +1302,12 @@ static struct rmap_item *scan_get_next_rmap_item(struct page **page) slot = list_entry(slot->mm_list.next, struct mm_slot, mm_list); ksm_scan.mm_slot = slot; spin_unlock(&ksm_mmlist_lock); + /* + * Although we tested list_empty() above, a racing __ksm_exit + * of the last mm on the list may have removed it since then. + */ + if (slot == &ksm_mm_head) + return NULL; next_mm: ksm_scan.address = 0; ksm_scan.rmap_list = &slot->rmap_list;
CWE-362
null
null
21,786
static inline struct rmap_item *alloc_rmap_item(void) { struct rmap_item *rmap_item; rmap_item = kmem_cache_zalloc(rmap_item_cache, GFP_KERNEL); if (rmap_item) ksm_rmap_items++; return rmap_item; }
DoS
0
static inline struct rmap_item *alloc_rmap_item(void) { struct rmap_item *rmap_item; rmap_item = kmem_cache_zalloc(rmap_item_cache, GFP_KERNEL); if (rmap_item) ksm_rmap_items++; return rmap_item; }
@@ -1302,6 +1302,12 @@ static struct rmap_item *scan_get_next_rmap_item(struct page **page) slot = list_entry(slot->mm_list.next, struct mm_slot, mm_list); ksm_scan.mm_slot = slot; spin_unlock(&ksm_mmlist_lock); + /* + * Although we tested list_empty() above, a racing __ksm_exit + * of the last mm on the list may have removed it since then. + */ + if (slot == &ksm_mm_head) + return NULL; next_mm: ksm_scan.address = 0; ksm_scan.rmap_list = &slot->rmap_list;
CWE-362
null
null
21,787
static inline struct stable_node *alloc_stable_node(void) { return kmem_cache_alloc(stable_node_cache, GFP_KERNEL); }
DoS
0
static inline struct stable_node *alloc_stable_node(void) { return kmem_cache_alloc(stable_node_cache, GFP_KERNEL); }
@@ -1302,6 +1302,12 @@ static struct rmap_item *scan_get_next_rmap_item(struct page **page) slot = list_entry(slot->mm_list.next, struct mm_slot, mm_list); ksm_scan.mm_slot = slot; spin_unlock(&ksm_mmlist_lock); + /* + * Although we tested list_empty() above, a racing __ksm_exit + * of the last mm on the list may have removed it since then. + */ + if (slot == &ksm_mm_head) + return NULL; next_mm: ksm_scan.address = 0; ksm_scan.rmap_list = &slot->rmap_list;
CWE-362
null
null
21,788
static int break_ksm(struct vm_area_struct *vma, unsigned long addr) { struct page *page; int ret = 0; do { cond_resched(); page = follow_page(vma, addr, FOLL_GET); if (IS_ERR_OR_NULL(page)) break; if (PageKsm(page)) ret = handle_mm_fault(vma->vm_mm, vma, addr, FAULT_FLAG_WRITE); else ret = VM_FAULT_WRITE; put_page(page); } while (!(ret & (VM_FAULT_WRITE | VM_FAULT_SIGBUS | VM_FAULT_OOM))); /* * We must loop because handle_mm_fault() may back out if there's * any difficulty e.g. if pte accessed bit gets updated concurrently. * * VM_FAULT_WRITE is what we have been hoping for: it indicates that * COW has been broken, even if the vma does not permit VM_WRITE; * but note that a concurrent fault might break PageKsm for us. * * VM_FAULT_SIGBUS could occur if we race with truncation of the * backing file, which also invalidates anonymous pages: that's * okay, that truncation will have unmapped the PageKsm for us. * * VM_FAULT_OOM: at the time of writing (late July 2009), setting * aside mem_cgroup limits, VM_FAULT_OOM would only be set if the * current task has TIF_MEMDIE set, and will be OOM killed on return * to user; and ksmd, having no mm, would never be chosen for that. * * But if the mm is in a limited mem_cgroup, then the fault may fail * with VM_FAULT_OOM even if the current task is not TIF_MEMDIE; and * even ksmd can fail in this way - though it's usually breaking ksm * just to undo a merge it made a moment before, so unlikely to oom. * * That's a pity: we might therefore have more kernel pages allocated * than we're counting as nodes in the stable tree; but ksm_do_scan * will retry to break_cow on each pass, so should recover the page * in due course. The important thing is to not let VM_MERGEABLE * be cleared while any such pages might remain in the area. */ return (ret & VM_FAULT_OOM) ? -ENOMEM : 0; }
DoS
0
static int break_ksm(struct vm_area_struct *vma, unsigned long addr) { struct page *page; int ret = 0; do { cond_resched(); page = follow_page(vma, addr, FOLL_GET); if (IS_ERR_OR_NULL(page)) break; if (PageKsm(page)) ret = handle_mm_fault(vma->vm_mm, vma, addr, FAULT_FLAG_WRITE); else ret = VM_FAULT_WRITE; put_page(page); } while (!(ret & (VM_FAULT_WRITE | VM_FAULT_SIGBUS | VM_FAULT_OOM))); /* * We must loop because handle_mm_fault() may back out if there's * any difficulty e.g. if pte accessed bit gets updated concurrently. * * VM_FAULT_WRITE is what we have been hoping for: it indicates that * COW has been broken, even if the vma does not permit VM_WRITE; * but note that a concurrent fault might break PageKsm for us. * * VM_FAULT_SIGBUS could occur if we race with truncation of the * backing file, which also invalidates anonymous pages: that's * okay, that truncation will have unmapped the PageKsm for us. * * VM_FAULT_OOM: at the time of writing (late July 2009), setting * aside mem_cgroup limits, VM_FAULT_OOM would only be set if the * current task has TIF_MEMDIE set, and will be OOM killed on return * to user; and ksmd, having no mm, would never be chosen for that. * * But if the mm is in a limited mem_cgroup, then the fault may fail * with VM_FAULT_OOM even if the current task is not TIF_MEMDIE; and * even ksmd can fail in this way - though it's usually breaking ksm * just to undo a merge it made a moment before, so unlikely to oom. * * That's a pity: we might therefore have more kernel pages allocated * than we're counting as nodes in the stable tree; but ksm_do_scan * will retry to break_cow on each pass, so should recover the page * in due course. The important thing is to not let VM_MERGEABLE * be cleared while any such pages might remain in the area. */ return (ret & VM_FAULT_OOM) ? -ENOMEM : 0; }
@@ -1302,6 +1302,12 @@ static struct rmap_item *scan_get_next_rmap_item(struct page **page) slot = list_entry(slot->mm_list.next, struct mm_slot, mm_list); ksm_scan.mm_slot = slot; spin_unlock(&ksm_mmlist_lock); + /* + * Although we tested list_empty() above, a racing __ksm_exit + * of the last mm on the list may have removed it since then. + */ + if (slot == &ksm_mm_head) + return NULL; next_mm: ksm_scan.address = 0; ksm_scan.rmap_list = &slot->rmap_list;
CWE-362
null
null
21,789
static u32 calc_checksum(struct page *page) { u32 checksum; void *addr = kmap_atomic(page, KM_USER0); checksum = jhash2(addr, PAGE_SIZE / 4, 17); kunmap_atomic(addr, KM_USER0); return checksum; }
DoS
0
static u32 calc_checksum(struct page *page) { u32 checksum; void *addr = kmap_atomic(page, KM_USER0); checksum = jhash2(addr, PAGE_SIZE / 4, 17); kunmap_atomic(addr, KM_USER0); return checksum; }
@@ -1302,6 +1302,12 @@ static struct rmap_item *scan_get_next_rmap_item(struct page **page) slot = list_entry(slot->mm_list.next, struct mm_slot, mm_list); ksm_scan.mm_slot = slot; spin_unlock(&ksm_mmlist_lock); + /* + * Although we tested list_empty() above, a racing __ksm_exit + * of the last mm on the list may have removed it since then. + */ + if (slot == &ksm_mm_head) + return NULL; next_mm: ksm_scan.address = 0; ksm_scan.rmap_list = &slot->rmap_list;
CWE-362
null
null
21,790
static void cmp_and_merge_page(struct page *page, struct rmap_item *rmap_item) { struct rmap_item *tree_rmap_item; struct page *tree_page = NULL; struct stable_node *stable_node; struct page *kpage; unsigned int checksum; int err; remove_rmap_item_from_tree(rmap_item); /* We first start with searching the page inside the stable tree */ kpage = stable_tree_search(page); if (kpage) { err = try_to_merge_with_ksm_page(rmap_item, page, kpage); if (!err) { /* * The page was successfully merged: * add its rmap_item to the stable tree. */ lock_page(kpage); stable_tree_append(rmap_item, page_stable_node(kpage)); unlock_page(kpage); } put_page(kpage); return; } /* * If the hash value of the page has changed from the last time * we calculated it, this page is changing frequently: therefore we * don't want to insert it in the unstable tree, and we don't want * to waste our time searching for something identical to it there. */ checksum = calc_checksum(page); if (rmap_item->oldchecksum != checksum) { rmap_item->oldchecksum = checksum; return; } tree_rmap_item = unstable_tree_search_insert(rmap_item, page, &tree_page); if (tree_rmap_item) { kpage = try_to_merge_two_pages(rmap_item, page, tree_rmap_item, tree_page); put_page(tree_page); /* * As soon as we merge this page, we want to remove the * rmap_item of the page we have merged with from the unstable * tree, and insert it instead as new node in the stable tree. */ if (kpage) { remove_rmap_item_from_tree(tree_rmap_item); lock_page(kpage); stable_node = stable_tree_insert(kpage); if (stable_node) { stable_tree_append(tree_rmap_item, stable_node); stable_tree_append(rmap_item, stable_node); } unlock_page(kpage); /* * If we fail to insert the page into the stable tree, * we will have 2 virtual addresses that are pointing * to a ksm page left outside the stable tree, * in which case we need to break_cow on both. */ if (!stable_node) { break_cow(tree_rmap_item); break_cow(rmap_item); } } } }
DoS
0
static void cmp_and_merge_page(struct page *page, struct rmap_item *rmap_item) { struct rmap_item *tree_rmap_item; struct page *tree_page = NULL; struct stable_node *stable_node; struct page *kpage; unsigned int checksum; int err; remove_rmap_item_from_tree(rmap_item); /* We first start with searching the page inside the stable tree */ kpage = stable_tree_search(page); if (kpage) { err = try_to_merge_with_ksm_page(rmap_item, page, kpage); if (!err) { /* * The page was successfully merged: * add its rmap_item to the stable tree. */ lock_page(kpage); stable_tree_append(rmap_item, page_stable_node(kpage)); unlock_page(kpage); } put_page(kpage); return; } /* * If the hash value of the page has changed from the last time * we calculated it, this page is changing frequently: therefore we * don't want to insert it in the unstable tree, and we don't want * to waste our time searching for something identical to it there. */ checksum = calc_checksum(page); if (rmap_item->oldchecksum != checksum) { rmap_item->oldchecksum = checksum; return; } tree_rmap_item = unstable_tree_search_insert(rmap_item, page, &tree_page); if (tree_rmap_item) { kpage = try_to_merge_two_pages(rmap_item, page, tree_rmap_item, tree_page); put_page(tree_page); /* * As soon as we merge this page, we want to remove the * rmap_item of the page we have merged with from the unstable * tree, and insert it instead as new node in the stable tree. */ if (kpage) { remove_rmap_item_from_tree(tree_rmap_item); lock_page(kpage); stable_node = stable_tree_insert(kpage); if (stable_node) { stable_tree_append(tree_rmap_item, stable_node); stable_tree_append(rmap_item, stable_node); } unlock_page(kpage); /* * If we fail to insert the page into the stable tree, * we will have 2 virtual addresses that are pointing * to a ksm page left outside the stable tree, * in which case we need to break_cow on both. */ if (!stable_node) { break_cow(tree_rmap_item); break_cow(rmap_item); } } } }
@@ -1302,6 +1302,12 @@ static struct rmap_item *scan_get_next_rmap_item(struct page **page) slot = list_entry(slot->mm_list.next, struct mm_slot, mm_list); ksm_scan.mm_slot = slot; spin_unlock(&ksm_mmlist_lock); + /* + * Although we tested list_empty() above, a racing __ksm_exit + * of the last mm on the list may have removed it since then. + */ + if (slot == &ksm_mm_head) + return NULL; next_mm: ksm_scan.address = 0; ksm_scan.rmap_list = &slot->rmap_list;
CWE-362
null
null
21,791
static inline void free_rmap_item(struct rmap_item *rmap_item) { ksm_rmap_items--; rmap_item->mm = NULL; /* debug safety */ kmem_cache_free(rmap_item_cache, rmap_item); }
DoS
0
static inline void free_rmap_item(struct rmap_item *rmap_item) { ksm_rmap_items--; rmap_item->mm = NULL; /* debug safety */ kmem_cache_free(rmap_item_cache, rmap_item); }
@@ -1302,6 +1302,12 @@ static struct rmap_item *scan_get_next_rmap_item(struct page **page) slot = list_entry(slot->mm_list.next, struct mm_slot, mm_list); ksm_scan.mm_slot = slot; spin_unlock(&ksm_mmlist_lock); + /* + * Although we tested list_empty() above, a racing __ksm_exit + * of the last mm on the list may have removed it since then. + */ + if (slot == &ksm_mm_head) + return NULL; next_mm: ksm_scan.address = 0; ksm_scan.rmap_list = &slot->rmap_list;
CWE-362
null
null
21,792
static inline void free_stable_node(struct stable_node *stable_node) { kmem_cache_free(stable_node_cache, stable_node); }
DoS
0
static inline void free_stable_node(struct stable_node *stable_node) { kmem_cache_free(stable_node_cache, stable_node); }
@@ -1302,6 +1302,12 @@ static struct rmap_item *scan_get_next_rmap_item(struct page **page) slot = list_entry(slot->mm_list.next, struct mm_slot, mm_list); ksm_scan.mm_slot = slot; spin_unlock(&ksm_mmlist_lock); + /* + * Although we tested list_empty() above, a racing __ksm_exit + * of the last mm on the list may have removed it since then. + */ + if (slot == &ksm_mm_head) + return NULL; next_mm: ksm_scan.address = 0; ksm_scan.rmap_list = &slot->rmap_list;
CWE-362
null
null
21,793
static struct page *get_ksm_page(struct stable_node *stable_node) { struct page *page; void *expected_mapping; page = pfn_to_page(stable_node->kpfn); expected_mapping = (void *)stable_node + (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM); rcu_read_lock(); if (page->mapping != expected_mapping) goto stale; if (!get_page_unless_zero(page)) goto stale; if (page->mapping != expected_mapping) { put_page(page); goto stale; } rcu_read_unlock(); return page; stale: rcu_read_unlock(); remove_node_from_stable_tree(stable_node); return NULL; }
DoS
0
static struct page *get_ksm_page(struct stable_node *stable_node) { struct page *page; void *expected_mapping; page = pfn_to_page(stable_node->kpfn); expected_mapping = (void *)stable_node + (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM); rcu_read_lock(); if (page->mapping != expected_mapping) goto stale; if (!get_page_unless_zero(page)) goto stale; if (page->mapping != expected_mapping) { put_page(page); goto stale; } rcu_read_unlock(); return page; stale: rcu_read_unlock(); remove_node_from_stable_tree(stable_node); return NULL; }
@@ -1302,6 +1302,12 @@ static struct rmap_item *scan_get_next_rmap_item(struct page **page) slot = list_entry(slot->mm_list.next, struct mm_slot, mm_list); ksm_scan.mm_slot = slot; spin_unlock(&ksm_mmlist_lock); + /* + * Although we tested list_empty() above, a racing __ksm_exit + * of the last mm on the list may have removed it since then. + */ + if (slot == &ksm_mm_head) + return NULL; next_mm: ksm_scan.address = 0; ksm_scan.rmap_list = &slot->rmap_list;
CWE-362
null
null
21,794
static struct page *get_mergeable_page(struct rmap_item *rmap_item) { struct mm_struct *mm = rmap_item->mm; unsigned long addr = rmap_item->address; struct vm_area_struct *vma; struct page *page; down_read(&mm->mmap_sem); if (ksm_test_exit(mm)) goto out; vma = find_vma(mm, addr); if (!vma || vma->vm_start > addr) goto out; if (!(vma->vm_flags & VM_MERGEABLE) || !vma->anon_vma) goto out; page = follow_page(vma, addr, FOLL_GET); if (IS_ERR_OR_NULL(page)) goto out; if (PageAnon(page) || page_trans_compound_anon(page)) { flush_anon_page(vma, page, addr); flush_dcache_page(page); } else { put_page(page); out: page = NULL; } up_read(&mm->mmap_sem); return page; }
DoS
0
static struct page *get_mergeable_page(struct rmap_item *rmap_item) { struct mm_struct *mm = rmap_item->mm; unsigned long addr = rmap_item->address; struct vm_area_struct *vma; struct page *page; down_read(&mm->mmap_sem); if (ksm_test_exit(mm)) goto out; vma = find_vma(mm, addr); if (!vma || vma->vm_start > addr) goto out; if (!(vma->vm_flags & VM_MERGEABLE) || !vma->anon_vma) goto out; page = follow_page(vma, addr, FOLL_GET); if (IS_ERR_OR_NULL(page)) goto out; if (PageAnon(page) || page_trans_compound_anon(page)) { flush_anon_page(vma, page, addr); flush_dcache_page(page); } else { put_page(page); out: page = NULL; } up_read(&mm->mmap_sem); return page; }
@@ -1302,6 +1302,12 @@ static struct rmap_item *scan_get_next_rmap_item(struct page **page) slot = list_entry(slot->mm_list.next, struct mm_slot, mm_list); ksm_scan.mm_slot = slot; spin_unlock(&ksm_mmlist_lock); + /* + * Although we tested list_empty() above, a racing __ksm_exit + * of the last mm on the list may have removed it since then. + */ + if (slot == &ksm_mm_head) + return NULL; next_mm: ksm_scan.address = 0; ksm_scan.rmap_list = &slot->rmap_list;
CWE-362
null
null
21,795
static struct rmap_item *get_next_rmap_item(struct mm_slot *mm_slot, struct rmap_item **rmap_list, unsigned long addr) { struct rmap_item *rmap_item; while (*rmap_list) { rmap_item = *rmap_list; if ((rmap_item->address & PAGE_MASK) == addr) return rmap_item; if (rmap_item->address > addr) break; *rmap_list = rmap_item->rmap_list; remove_rmap_item_from_tree(rmap_item); free_rmap_item(rmap_item); } rmap_item = alloc_rmap_item(); if (rmap_item) { /* It has already been zeroed */ rmap_item->mm = mm_slot->mm; rmap_item->address = addr; rmap_item->rmap_list = *rmap_list; *rmap_list = rmap_item; } return rmap_item; }
DoS
0
static struct rmap_item *get_next_rmap_item(struct mm_slot *mm_slot, struct rmap_item **rmap_list, unsigned long addr) { struct rmap_item *rmap_item; while (*rmap_list) { rmap_item = *rmap_list; if ((rmap_item->address & PAGE_MASK) == addr) return rmap_item; if (rmap_item->address > addr) break; *rmap_list = rmap_item->rmap_list; remove_rmap_item_from_tree(rmap_item); free_rmap_item(rmap_item); } rmap_item = alloc_rmap_item(); if (rmap_item) { /* It has already been zeroed */ rmap_item->mm = mm_slot->mm; rmap_item->address = addr; rmap_item->rmap_list = *rmap_list; *rmap_list = rmap_item; } return rmap_item; }
@@ -1302,6 +1302,12 @@ static struct rmap_item *scan_get_next_rmap_item(struct page **page) slot = list_entry(slot->mm_list.next, struct mm_slot, mm_list); ksm_scan.mm_slot = slot; spin_unlock(&ksm_mmlist_lock); + /* + * Although we tested list_empty() above, a racing __ksm_exit + * of the last mm on the list may have removed it since then. + */ + if (slot == &ksm_mm_head) + return NULL; next_mm: ksm_scan.address = 0; ksm_scan.rmap_list = &slot->rmap_list;
CWE-362
null
null
21,796
static inline int in_stable_tree(struct rmap_item *rmap_item) { return rmap_item->address & STABLE_FLAG; }
DoS
0
static inline int in_stable_tree(struct rmap_item *rmap_item) { return rmap_item->address & STABLE_FLAG; }
@@ -1302,6 +1302,12 @@ static struct rmap_item *scan_get_next_rmap_item(struct page **page) slot = list_entry(slot->mm_list.next, struct mm_slot, mm_list); ksm_scan.mm_slot = slot; spin_unlock(&ksm_mmlist_lock); + /* + * Although we tested list_empty() above, a racing __ksm_exit + * of the last mm on the list may have removed it since then. + */ + if (slot == &ksm_mm_head) + return NULL; next_mm: ksm_scan.address = 0; ksm_scan.rmap_list = &slot->rmap_list;
CWE-362
null
null
21,797
static void insert_to_mm_slots_hash(struct mm_struct *mm, struct mm_slot *mm_slot) { struct hlist_head *bucket; bucket = &mm_slots_hash[hash_ptr(mm, MM_SLOTS_HASH_SHIFT)]; mm_slot->mm = mm; hlist_add_head(&mm_slot->link, bucket); }
DoS
0
static void insert_to_mm_slots_hash(struct mm_struct *mm, struct mm_slot *mm_slot) { struct hlist_head *bucket; bucket = &mm_slots_hash[hash_ptr(mm, MM_SLOTS_HASH_SHIFT)]; mm_slot->mm = mm; hlist_add_head(&mm_slot->link, bucket); }
@@ -1302,6 +1302,12 @@ static struct rmap_item *scan_get_next_rmap_item(struct page **page) slot = list_entry(slot->mm_list.next, struct mm_slot, mm_list); ksm_scan.mm_slot = slot; spin_unlock(&ksm_mmlist_lock); + /* + * Although we tested list_empty() above, a racing __ksm_exit + * of the last mm on the list may have removed it since then. + */ + if (slot == &ksm_mm_head) + return NULL; next_mm: ksm_scan.address = 0; ksm_scan.rmap_list = &slot->rmap_list;
CWE-362
null
null
21,798
static struct stable_node *ksm_check_stable_tree(unsigned long start_pfn, unsigned long end_pfn) { struct rb_node *node; for (node = rb_first(&root_stable_tree); node; node = rb_next(node)) { struct stable_node *stable_node; stable_node = rb_entry(node, struct stable_node, node); if (stable_node->kpfn >= start_pfn && stable_node->kpfn < end_pfn) return stable_node; } return NULL; }
DoS
0
static struct stable_node *ksm_check_stable_tree(unsigned long start_pfn, unsigned long end_pfn) { struct rb_node *node; for (node = rb_first(&root_stable_tree); node; node = rb_next(node)) { struct stable_node *stable_node; stable_node = rb_entry(node, struct stable_node, node); if (stable_node->kpfn >= start_pfn && stable_node->kpfn < end_pfn) return stable_node; } return NULL; }
@@ -1302,6 +1302,12 @@ static struct rmap_item *scan_get_next_rmap_item(struct page **page) slot = list_entry(slot->mm_list.next, struct mm_slot, mm_list); ksm_scan.mm_slot = slot; spin_unlock(&ksm_mmlist_lock); + /* + * Although we tested list_empty() above, a racing __ksm_exit + * of the last mm on the list may have removed it since then. + */ + if (slot == &ksm_mm_head) + return NULL; next_mm: ksm_scan.address = 0; ksm_scan.rmap_list = &slot->rmap_list;
CWE-362
null
null
21,799
static void ksm_do_scan(unsigned int scan_npages) { struct rmap_item *rmap_item; struct page *uninitialized_var(page); while (scan_npages-- && likely(!freezing(current))) { cond_resched(); rmap_item = scan_get_next_rmap_item(&page); if (!rmap_item) return; if (!PageKsm(page) || !in_stable_tree(rmap_item)) cmp_and_merge_page(page, rmap_item); put_page(page); } }
DoS
0
static void ksm_do_scan(unsigned int scan_npages) { struct rmap_item *rmap_item; struct page *uninitialized_var(page); while (scan_npages-- && likely(!freezing(current))) { cond_resched(); rmap_item = scan_get_next_rmap_item(&page); if (!rmap_item) return; if (!PageKsm(page) || !in_stable_tree(rmap_item)) cmp_and_merge_page(page, rmap_item); put_page(page); } }
@@ -1302,6 +1302,12 @@ static struct rmap_item *scan_get_next_rmap_item(struct page **page) slot = list_entry(slot->mm_list.next, struct mm_slot, mm_list); ksm_scan.mm_slot = slot; spin_unlock(&ksm_mmlist_lock); + /* + * Although we tested list_empty() above, a racing __ksm_exit + * of the last mm on the list may have removed it since then. + */ + if (slot == &ksm_mm_head) + return NULL; next_mm: ksm_scan.address = 0; ksm_scan.rmap_list = &slot->rmap_list;
CWE-362
null
null