Among others fix possible usage of large stack allocation.
h1 = rotl (h1, 13);
h1 = h1 * 5 + 0xe6546b64;
}
+ va_end (va);
/* tail */
return_val_if_fail (lexer != NULL, false);
clear_state (lexer);
- *failed = false;
+ if (failed)
+ *failed = false;
/* Go through lines and process them */
while (lexer->remaining != 0) {
CK_OBJECT_HANDLE object;
/* And various flags */
- int searching : 1;
- int searched : 1;
- int iterating : 1;
- int match_nothing : 1;
- int keep_session : 1;
- int preload_results : 1;
+ unsigned int searching : 1;
+ unsigned int searched : 1;
+ unsigned int iterating : 1;
+ unsigned int match_nothing : 1;
+ unsigned int keep_session : 1;
+ unsigned int preload_results : 1;
};
/**
/* At this point we have no command */
p11_message ("'%s' is not a valid command. See 'p11-kit --help'", argv[0]);
+
+ free (filename);
+ free (path);
return 2;
}
/* At this point we have no command */
p11_message ("'%s' is not a valid command. See 'p11-kit --help'", argv[0]);
+
+ free (path);
+ free (args);
return 2;
}
module.C_Finalize = mock_C_Finalize__threaded_race;
memset (&data, 0, sizeof (data));
+
+ p11_mutex_lock (&race_mutex);
initialization_count = 0;
finalization_count = 0;
+ p11_mutex_unlock (&race_mutex);
p11_lock ();
break;
case opt_filter:
if (!filter_argument (optarg, &uri, &match, &ex.flags))
- return 2;
+ exit (2);
break;
case opt_purpose:
if (!purpose_argument (optarg, &ex))
- return 2;
+ exit (2);
break;
case opt_format:
if (!format_argument (optarg, &format))
- return 2;
+ exit (2);
break;
case 'h':
p11_tool_usage (usages, options);
- return 0;
+ exit (0);
case '?':
- return 2;
+ exit (2);
default:
assert_not_reached ();
break;
}
- } while (opt != -1);
+ }
argc -= optind;
argv += optind;
if (argc != 1) {
p11_message ("specify one destination file or directory");
- return 2;
+ exit (2);
}
ex.destination = argv[0];
if (!format) {
p11_message ("no output format specified");
- return 2;
+ exit (2);
}
/* If nothing that was useful to enumerate was specified, then bail */
}
if (!validate_filter_and_format (&ex, format, match))
- return 1;
+ exit (1);
if (uri && p11_kit_uri_any_unrecognized (uri))
p11_message ("uri contained unrecognized components, nothing will be extracted");
modules = p11_kit_modules_load_and_initialize (flags);
if (!modules)
- return 1;
+ exit (1);
if (modules[0] == NULL)
p11_message ("no modules containing trust policy are registered");
index_sink sink,
void *data)
{
- index_bucket *buckets[NUM_BUCKETS];
+ index_bucket *selected[MAX_SELECT];
CK_OBJECT_HANDLE handle;
index_object *obj;
unsigned int hash;
for (n = 0, num = 0; n < count && num < MAX_SELECT; n++) {
if (is_indexable (index, match[n].type)) {
hash = p11_attr_hash (match + n);
- buckets[num] = index->buckets + (hash % NUM_BUCKETS);
+ selected[num] = index->buckets + (hash % NUM_BUCKETS);
/* If any index is empty, then obviously no match */
- if (!buckets[num]->num)
+ if (!selected[num]->num)
return;
num++;
return;
}
- for (i = 0; i < buckets[0]->num; i++) {
+ for (i = 0; i < selected[0]->num; i++) {
/* A candidate match from first bucket */
- handle = buckets[0]->elem[i];
+ handle = selected[0]->elem[i];
/* Check if the candidate is in other buckets */
for (j = 1; j < num; j++) {
- assert (buckets[j]->elem); /* checked above */
- at = binary_search (buckets[j]->elem, 0, buckets[j]->num, handle);
- if (at >= buckets[j]->num || buckets[j]->elem[at] != handle) {
+ assert (selected[j]->elem); /* checked above */
+ at = binary_search (selected[j]->elem, 0, selected[j]->num, handle);
+ if (at >= selected[j]->num || selected[j]->elem[at] != handle) {
handle = 0;
break;
}
return_val_if_fail (index != NULL, NULL);
- if (count < 0)
+ if (count < (CK_ULONG)0UL)
count = p11_attrs_count (attrs);
index_select (index, attrs, count, sink_any, &handles);
* Otherwise a 'TRUSTED CERTIFICATE' in an input directory is enough to
* mark this as a trusted certificate.
*/
- } else if (p11_dict_size (trust) > 0) {
+ } else if (trust && p11_dict_size (trust) > 0) {
trusted = CK_TRUE;
distrust = CK_FALSE;
}
free (string);
free (label.pValue);
+ free (name);
}
static int
...)
{
CK_OBJECT_HANDLE handle;
+ bool matched = true;
int count;
int num;
va_list va;
va_start (va, handles);
- for (count = 0; true; count++) {
+ for (count = 0; matched; count++) {
handle = va_arg (va, CK_OBJECT_HANDLE);
if (handle == 0)
break;
}
if (handles[i] != handle)
- return false;
+ matched = false;
}
va_end (va);
- return (count == num);
+ return matched && (count == num);
}
static void