47d322ad49
standard headers, etc. "time_t" is not "long". Don't issue own declarations of standard functions. Should fix Solaris build.
35 lines
936 B
Text
35 lines
936 B
Text
$NetBSD: patch-ak,v 1.3 2014/06/29 03:24:33 dholland Exp $
|
|
|
|
- use <ctype.h> correctly
|
|
- avoid string overflow
|
|
|
|
--- misc.c.orig 1991-07-16 15:52:54.000000000 +0000
|
|
+++ misc.c
|
|
@@ -41,7 +41,7 @@ char *str;
|
|
char *p;
|
|
retval = 0L;
|
|
p = str; /* save for error message */
|
|
- while (isdigit(*str)) {
|
|
+ while (isdigit((unsigned char)*str)) {
|
|
retval = retval * 10L + (*str-'0');
|
|
str++;
|
|
}
|
|
@@ -135,11 +135,17 @@ if available, else the short filename is
|
|
char *fullpath (direntry)
|
|
struct direntry *direntry;
|
|
{
|
|
- static char result[PATHSIZE];
|
|
+ static char result[PATHSIZE+LFNAMESIZE+12]; /* Room for enough space.*/
|
|
combine (result,
|
|
direntry->dirlen != 0 ? direntry->dirname : "",
|
|
(direntry->namlen != 0) ? direntry->lfname : direntry->fname
|
|
);
|
|
+
|
|
+ if (strlen (result) >= PATHSIZE) {
|
|
+ prterror ('f', "Combined dirname and filename too long!\n");
|
|
+ *result = '\0';
|
|
+ }
|
|
+
|
|
return (result);
|
|
}
|
|
|