summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Carbonneaux2023-03-01 10:32:45 +0100
committerQuentin Carbonneaux2023-03-01 10:32:45 +0100
commit6a27a7ee3c163e5b50ea9a9a5d4a4b91fdf1c727 (patch)
treee56ea94db9dd58a2d42eb309caa58e1c42e6459c
parent7ee8191a21496ac38e017ce819ae7b19c54e2a87 (diff)
fix some warnings
-rw-r--r--sdar/lib/blake3/blake3_dispatch.c2
-rw-r--r--sdar/lib/nacl/generic/salsa20_stream.c4
-rw-r--r--sdar/main.c3
-rw-r--r--sdar/util.c4
4 files changed, 7 insertions, 6 deletions
diff --git a/sdar/lib/blake3/blake3_dispatch.c b/sdar/lib/blake3/blake3_dispatch.c
index 0f348ef..f59ddd0 100644
--- a/sdar/lib/blake3/blake3_dispatch.c
+++ b/sdar/lib/blake3/blake3_dispatch.c
@@ -73,6 +73,7 @@ enum cpu_feature {
UNDEFINED = 1 << 30
};
+#if defined(IS_X86)
#if !defined(BLAKE3_TESTING)
static /* Allow the variable to be controlled manually for testing */
#endif
@@ -132,6 +133,7 @@ static
#endif
}
}
+#endif
void blake3_compress_in_place(uint32_t cv[8],
const uint8_t block[BLAKE3_BLOCK_LEN],
diff --git a/sdar/lib/nacl/generic/salsa20_stream.c b/sdar/lib/nacl/generic/salsa20_stream.c
index 88e5f1e..2881ce8 100644
--- a/sdar/lib/nacl/generic/salsa20_stream.c
+++ b/sdar/lib/nacl/generic/salsa20_stream.c
@@ -18,7 +18,7 @@ int crypto_stream_salsa20(
{
unsigned char in[16];
unsigned char block[64];
- int i;
+ unsigned int i;
unsigned int u;
if (!clen) return 0;
@@ -56,7 +56,7 @@ int crypto_stream_salsa20_xor(
{
unsigned char in[16];
unsigned char block[64];
- int i;
+ unsigned int i;
unsigned int u;
if (!mlen) return 0;
diff --git a/sdar/main.c b/sdar/main.c
index c5123c2..a7100da 100644
--- a/sdar/main.c
+++ b/sdar/main.c
@@ -827,8 +827,7 @@ getcmdline(char *argv[])
}
p = buf;
for (pa = argv; *pa; pa++)
- p += sprintf(p, "%s ", *pa);
- p[-1] = 0;
+ p += snprintf(p, sz-(p-buf), "%s ", *pa);
return buf;
}
diff --git a/sdar/util.c b/sdar/util.c
index 7d9eab1..ba93848 100644
--- a/sdar/util.c
+++ b/sdar/util.c
@@ -25,7 +25,7 @@ logs(char *fmt, ...)
tm = localtime(&tv.tv_sec);
strftime(date, sizeof date, "%F %H:%M:%S", tm);
va_start(ap, fmt);
- vsprintf(msg, fmt, ap);
+ vsnprintf(msg, sizeof(msg), fmt, ap);
va_end(ap);
fprintf(flog, "[%u %s] %s\n", (uint)pid, date, msg);
}
@@ -38,7 +38,7 @@ hexs(uchar *d, int n)
assert(n <= 32);
for (p = buf; n-- > 0; p += 2, d++)
- sprintf(p, "%02x", (uint)*d);
+ snprintf(p, 2, "%02x", (uint)*d);
return buf;
}