Skip to content

Commit fe3663c

Browse files
authored
Merge pull request #15 from douzzer/20260409-fixes
20260409-fixes
2 parents e0211e9 + 3705772 commit fe3663c

5 files changed

Lines changed: 17 additions & 12 deletions

File tree

kernel-src/dkms.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PACKAGE_NAME="wolfguard"
2-
PACKAGE_VERSION="1.1.20260319"
2+
PACKAGE_VERSION="1.1.20260409"
33
AUTOINSTALL=yes
44

55
BUILT_MODULE_NAME="wolfguard"

kernel-src/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#ifndef WOLFGUARD_VERSION
2-
#define WOLFGUARD_VERSION "1.1.20260319"
2+
#define WOLFGUARD_VERSION "1.1.20260409"
33
#endif

kernel-src/wolfcrypt_glue.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static __always_inline bool wc_AesGcm_crypt_sg_inplace(struct scatterlist *src,
186186
struct sg_mapping_iter miter;
187187
int miter_needs_stop = 0;
188188
unsigned int flags;
189-
int sl;
189+
ssize_t sl;
190190
Aes *aes = NULL;
191191
byte full_nonce[AES_IV_SIZE];
192192

@@ -249,8 +249,8 @@ static __always_inline bool wc_AesGcm_crypt_sg_inplace(struct scatterlist *src,
249249
sg_miter_start(&miter, src, sg_nents(src), flags);
250250
miter_needs_stop = 1;
251251

252-
for (sl = src_len; sl > 0 && sg_miter_next(&miter); sl -= miter.length) {
253-
size_t length = min_t(size_t, sl, miter.length);
252+
for (sl = (ssize_t)src_len; sl > 0 && sg_miter_next(&miter); sl -= miter.length) {
253+
size_t length = min_t(size_t, sl, (ssize_t)miter.length);
254254

255255
if (isDecrypt)
256256
ret = wc_AesGcmDecryptUpdate(aes, miter.addr, miter.addr,
@@ -271,9 +271,9 @@ static __always_inline bool wc_AesGcm_crypt_sg_inplace(struct scatterlist *src,
271271
*/
272272
if (sl <= -WC_AES_BLOCK_SIZE) {
273273
if (isDecrypt)
274-
ret = wc_AesGcmDecryptFinal(aes, miter.addr + miter.length + sl, WC_AES_BLOCK_SIZE);
274+
ret = wc_AesGcmDecryptFinal(aes, miter.addr + (ssize_t)miter.length + sl, WC_AES_BLOCK_SIZE);
275275
else
276-
ret = wc_AesGcmEncryptFinal(aes, miter.addr + miter.length + sl, WC_AES_BLOCK_SIZE);
276+
ret = wc_AesGcmEncryptFinal(aes, miter.addr + (ssize_t)miter.length + sl, WC_AES_BLOCK_SIZE);
277277
if (ret < 0) {
278278
WC_DEBUG_PR_CODEPOINT();
279279
goto out;

user-src/config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ static inline bool parse_endpoint(struct sockaddr *endpoint, const char *value)
287287
#ifdef EAI_NODATA
288288
ret == EAI_NODATA ||
289289
#endif
290-
(retries == 0) || (retries == 1)) {
290+
(retries == 0)) {
291291
free(mutable);
292292
fprintf(stderr, "%s: `%s'\n", ret == EAI_SYSTEM ? strerror(errno) : gai_strerror(ret), value);
293293
return false;

user-src/show.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,20 @@ static size_t pretty_time(char *buf, const size_t len, unsigned long long left)
181181

182182
if (years)
183183
offset += snprintf(buf + offset, len - offset, "%s%llu " TERMINAL_FG_CYAN "year%s" TERMINAL_RESET, offset ? ", " : "", years, years == 1 ? "" : "s");
184-
if (days)
184+
if (days && (offset < len))
185185
offset += snprintf(buf + offset, len - offset, "%s%llu " TERMINAL_FG_CYAN "day%s" TERMINAL_RESET, offset ? ", " : "", days, days == 1 ? "" : "s");
186-
if (hours)
186+
if (hours && (offset < len))
187187
offset += snprintf(buf + offset, len - offset, "%s%llu " TERMINAL_FG_CYAN "hour%s" TERMINAL_RESET, offset ? ", " : "", hours, hours == 1 ? "" : "s");
188-
if (minutes)
188+
if (minutes && (offset < len))
189189
offset += snprintf(buf + offset, len - offset, "%s%llu " TERMINAL_FG_CYAN "minute%s" TERMINAL_RESET, offset ? ", " : "", minutes, minutes == 1 ? "" : "s");
190-
if (seconds)
190+
if (seconds && (offset < len))
191191
offset += snprintf(buf + offset, len - offset, "%s%llu " TERMINAL_FG_CYAN "second%s" TERMINAL_RESET, offset ? ", " : "", seconds, seconds == 1 ? "" : "s");
192192

193+
if (offset >= len) {
194+
buf[len-1] = '\0';
195+
offset = len -1;
196+
}
197+
193198
return offset;
194199
}
195200

0 commit comments

Comments
 (0)