ensure all vmkpath implementations check their parameters

This commit is contained in:
Vincent Sanders 2014-05-17 22:26:34 +01:00
parent 7ba459f1b5
commit 0a2082d777
2 changed files with 8 additions and 0 deletions

View File

@ -262,6 +262,10 @@ static nserror amiga_vmkpath(char **str, size_t *size, size_t nelm, va_list ap)
*/
for (elm_idx = 0; elm_idx < nelm; elm_idx++) {
elm[elm_idx] = va_arg(ap, const char *);
/* check the argument is not NULL */
if (elm[elm_idx] == NULL) {
return NSERROR_BAD_PARAMETER;
}
elm_len[elm_idx] = strlen(elm[elm_idx]);
fname_len += elm_len[elm_idx];
}

View File

@ -2334,6 +2334,10 @@ static nserror riscos_mkpath(char **str, size_t *size, size_t nelm, va_list ap)
*/
for (elm_idx = 0; elm_idx < nelm; elm_idx++) {
elm[elm_idx] = va_arg(ap, const char *);
/* check the argument is not NULL */
if (elm[elm_idx] == NULL) {
return NSERROR_BAD_PARAMETER;
}
elm_len[elm_idx] = strlen(elm[elm_idx]);
fname_len += elm_len[elm_idx];
}