Revert some of the strlcpy() conversions which are wrong.

This commit is contained in:
matthieu 2018-07-10 15:32:27 +00:00
parent 8b4158c82d
commit a8c7a38ea4
3 changed files with 12 additions and 7 deletions

View File

@ -89,7 +89,8 @@ splitIntoWords (char *s)
freeFileArgs (args);
return NULL;
}
strlcpy (args[nargs], wordStart, s - wordStart);
strncpy (args[nargs], wordStart, s - wordStart);
args[nargs][s-wordStart] = '\0';
++nargs;
args[nargs] = NULL;
}

View File

@ -260,15 +260,18 @@ GetResource (
LogOutOfMem ("GetResource");
return;
}
strlcpy (new_string, string, len);
strncpy (new_string, string, len);
new_string[len] = '\0';
*(valuep) = new_string;
break;
case DM_INT:
strlcpy (str_buf, string, sizeof (str_buf));
strncpy (str_buf, string, sizeof (str_buf));
str_buf[sizeof (str_buf)-1] = '\0';
*((int *) valuep) = atoi (str_buf);
break;
case DM_BOOL:
strlcpy (str_buf, string, sizeof (str_buf));
strncpy (str_buf, string, sizeof (str_buf));
str_buf[sizeof (str_buf)-1] = '\0';
XmuCopyISOLatin1Lowered (str_buf, str_buf);
if (!strcmp (str_buf, "true") ||
!strcmp (str_buf, "on") ||

View File

@ -136,7 +136,8 @@ putEnv(const char *string, char **env)
return NULL;
}
strlcpy(n, string,nl + 1);
strlcpy(n, string, nl + 1);
n[nl] = 0;
env = setEnv(env,n,v);
free(n);
@ -192,8 +193,8 @@ parseArgs (char **argv, const char *string)
} else {
argv = newargv;
}
strlcpy (save, word, string-word);
argv[i] = save;
argv[i] = strncpy (save, word, string-word);
argv[i][string-word] = '\0';
i++;
}
if (!*string)