Cast size_t len arguments to %.*s to int
This commit is contained in:
@@ -518,7 +518,7 @@ static bool load_pin(private_stroke_cred_t *this, chunk_t line, int line_nr,
|
|||||||
DBG1(DBG_CFG, "line %d: expected %%smartcard specifier", line_nr);
|
DBG1(DBG_CFG, "line %d: expected %%smartcard specifier", line_nr);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
snprintf(smartcard, sizeof(smartcard), "%.*s", sc.len, sc.ptr);
|
snprintf(smartcard, sizeof(smartcard), "%.*s", (int)sc.len, sc.ptr);
|
||||||
smartcard[sizeof(smartcard) - 1] = '\0';
|
smartcard[sizeof(smartcard) - 1] = '\0';
|
||||||
|
|
||||||
/* parse slot and key id. Three formats are supported:
|
/* parse slot and key id. Three formats are supported:
|
||||||
@@ -660,13 +660,13 @@ static bool load_private(private_stroke_cred_t *this, chunk_t line, int line_nr,
|
|||||||
if (*filename.ptr == '/')
|
if (*filename.ptr == '/')
|
||||||
{
|
{
|
||||||
/* absolute path name */
|
/* absolute path name */
|
||||||
snprintf(path, sizeof(path), "%.*s", filename.len, filename.ptr);
|
snprintf(path, sizeof(path), "%.*s", (int)filename.len, filename.ptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* relative path name */
|
/* relative path name */
|
||||||
snprintf(path, sizeof(path), "%s/%.*s", PRIVATE_KEY_DIR,
|
snprintf(path, sizeof(path), "%s/%.*s", PRIVATE_KEY_DIR,
|
||||||
filename.len, filename.ptr);
|
(int)filename.len, filename.ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for optional passphrase */
|
/* check for optional passphrase */
|
||||||
@@ -876,7 +876,8 @@ static void load_secrets(private_stroke_cred_t *this, char *file, int level,
|
|||||||
DBG1(DBG_CFG, "include pattern too long, ignored");
|
DBG1(DBG_CFG, "include pattern too long, ignored");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
snprintf(pattern, sizeof(pattern), "%.*s", line.len, line.ptr);
|
snprintf(pattern, sizeof(pattern), "%.*s",
|
||||||
|
(int)line.len, line.ptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* use directory of current file if relative */
|
{ /* use directory of current file if relative */
|
||||||
@@ -890,7 +891,7 @@ static void load_secrets(private_stroke_cred_t *this, char *file, int level,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
snprintf(pattern, sizeof(pattern), "%s/%.*s",
|
snprintf(pattern, sizeof(pattern), "%s/%.*s",
|
||||||
dir, line.len, line.ptr);
|
dir, (int)line.len, line.ptr);
|
||||||
free(dir);
|
free(dir);
|
||||||
}
|
}
|
||||||
if (glob(pattern, GLOB_ERR, NULL, &buf) != 0)
|
if (glob(pattern, GLOB_ERR, NULL, &buf) != 0)
|
||||||
|
|||||||
@@ -396,7 +396,7 @@ static void stroke_export(private_stroke_socket_t *this,
|
|||||||
{
|
{
|
||||||
if (cert->get_encoding(cert, CERT_PEM, &encoded))
|
if (cert->get_encoding(cert, CERT_PEM, &encoded))
|
||||||
{
|
{
|
||||||
fprintf(out, "%.*s", encoded.len, encoded.ptr);
|
fprintf(out, "%.*s", (int)encoded.len, encoded.ptr);
|
||||||
free(encoded.ptr);
|
free(encoded.ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ static bool parse_attributes(char *name, char *value, value_type_t *value_type,
|
|||||||
/* clean up */
|
/* clean up */
|
||||||
DESTROY_IF(addr);
|
DESTROY_IF(addr);
|
||||||
|
|
||||||
/* is the attribute type numeric? */
|
/* is the attribute type numeric? */
|
||||||
*type = strtol(name, &endptr, 10);
|
*type = strtol(name, &endptr, 10);
|
||||||
|
|
||||||
if (*endptr != '\0')
|
if (*endptr != '\0')
|
||||||
@@ -262,7 +262,7 @@ static bool parse_attributes(char *name, char *value, value_type_t *value_type,
|
|||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lookup/insert an attribute pool by name
|
* Lookup/insert an attribute pool by name
|
||||||
*/
|
*/
|
||||||
@@ -541,11 +541,11 @@ void del_attr(char *name, char *pool, char *identity,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (value_type == VALUE_ADDR)
|
if (value_type == VALUE_ADDR)
|
||||||
{
|
{
|
||||||
host_t *server = host_create_from_chunk(AF_UNSPEC, blob, 0);
|
host_t *server = host_create_from_chunk(AF_UNSPEC, blob, 0);
|
||||||
|
|
||||||
fprintf(stderr, "the %s server %H%s was not found.\n", name,
|
fprintf(stderr, "the %s server %H%s was not found.\n", name,
|
||||||
server, id_pool_str);
|
server, id_pool_str);
|
||||||
server->destroy(server);
|
server->destroy(server);
|
||||||
@@ -630,7 +630,7 @@ void status_attr(bool hexout)
|
|||||||
if (type == attr_info[i].type)
|
if (type == attr_info[i].type)
|
||||||
{
|
{
|
||||||
value_type = attr_info[i].value_type;
|
value_type = attr_info[i].value_type;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -671,8 +671,8 @@ void status_attr(bool hexout)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VALUE_STRING:
|
case VALUE_STRING:
|
||||||
printf("\"%.*s\"\n", value.len, value.ptr);
|
printf("\"%.*s\"\n", (int)value.len, value.ptr);
|
||||||
break;
|
break;
|
||||||
case VALUE_HEX:
|
case VALUE_HEX:
|
||||||
default:
|
default:
|
||||||
printf(" %#B\n", &value);
|
printf(" %#B\n", &value);
|
||||||
@@ -692,13 +692,13 @@ void show_attr(void)
|
|||||||
for (i = 0; i < countof(attr_info); i++)
|
for (i = 0; i < countof(attr_info); i++)
|
||||||
{
|
{
|
||||||
char value_name[10];
|
char value_name[10];
|
||||||
|
|
||||||
|
|
||||||
snprintf(value_name, sizeof(value_name), "%N",
|
snprintf(value_name, sizeof(value_name), "%N",
|
||||||
value_type_names, attr_info[i].value_type);
|
value_type_names, attr_info[i].value_type);
|
||||||
|
|
||||||
printf("%-20s --%-6s (%N",
|
printf("%-20s --%-6s (%N",
|
||||||
attr_info[i].keyword, value_name,
|
attr_info[i].keyword, value_name,
|
||||||
configuration_attribute_type_names, attr_info[i].type);
|
configuration_attribute_type_names, attr_info[i].type);
|
||||||
|
|
||||||
if (attr_info[i].type_ip6)
|
if (attr_info[i].type_ip6)
|
||||||
|
|||||||
+1
-1
@@ -133,7 +133,7 @@ static void write_serial(chunk_t serial)
|
|||||||
|
|
||||||
DBG1(DBG_LIB, " serial number is %#B", &serial);
|
DBG1(DBG_LIB, " serial number is %#B", &serial);
|
||||||
hex_serial = chunk_to_hex(serial, NULL, FALSE);
|
hex_serial = chunk_to_hex(serial, NULL, FALSE);
|
||||||
fprintf(fd, "%.*s\n", hex_serial.len, hex_serial.ptr);
|
fprintf(fd, "%.*s\n", (int)hex_serial.len, hex_serial.ptr);
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
free(hex_serial.ptr);
|
free(hex_serial.ptr);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -309,8 +309,9 @@ static char* complete_uri(char *distPoint, const char *ldaphost)
|
|||||||
char uri[BUF_LEN];
|
char uri[BUF_LEN];
|
||||||
|
|
||||||
/* insert the ldaphost into the uri */
|
/* insert the ldaphost into the uri */
|
||||||
snprintf(uri, BUF_LEN, "%.*s%s%.*s", strlen(distPoint)-len,
|
snprintf(uri, BUF_LEN, "%.*s%s%.*s",
|
||||||
distPoint, ldaphost, len, symbol);
|
(int)strlen(distPoint) - len, distPoint, ldaphost,
|
||||||
|
len, symbol);
|
||||||
return strdup(uri);
|
return strdup(uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user