Skip to content

Commit 361b4d6

Browse files
committed
FIX: silent "The prior call to 'wcsncpy' might not zero-terminate string" warnings
1 parent 79c3e6c commit 361b4d6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/os/win32/host-lib.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ static void *Task_Ready;
112112
if (spot) {
113113
// Save rest of cmd line (such as end quote, -flags, etc.)
114114
COPY_STR(hold, spot+2, HOLD_SIZE);
115+
hold[HOLD_SIZE] = 0;
115116

116117
// Terminate at the arg location:
117118
spot[0] = 0;
@@ -454,6 +455,7 @@ static void *Task_Ready;
454455
if (!ok) COPY_STR(str, TEXT("unknown error"), len);
455456
else {
456457
COPY_STR(str, lpMsgBuf, len);
458+
str[len] = 0;
457459
len = (int)LEN_STR(str);
458460
if (str[len-2] == '\r' && str[len-1] == '\n') str[len-2] = 0; // trim CRLF
459461
LocalFree(lpMsgBuf);
@@ -556,7 +558,7 @@ static void *Task_Ready;
556558
REBCHR *str;
557559

558560
str = env;
559-
while (n = (REBCNT)LEN_STR(str)) {
561+
while ((n = (REBCNT)LEN_STR(str))) {
560562
len += n + 1;
561563
str = env + len; // next
562564
}

0 commit comments

Comments
 (0)