Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37415791
en ru br
Репозитории ALT
S:2.3.15-alt6
5.1: 2.3.14-alt3
4.1: 2.3.14-alt3
4.0: 2.3.14-alt2
3.0: 2.3.13-alt4
www.altlinux.org/Changes

Группа :: Система/Основа
Пакет: xinetd

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: xinetd-2.3.15-owl-fixes.patch
Скачать


--- xinetd/libs/src/portable/cvt.c
+++ xinetd/libs/src/portable/cvt.c
@@ -115,7 +115,7 @@ APPEND (FUNC_PREFIX, fcvt_r) (FLOAT_TYPE value,
        return -1;
 
     i = 0;
-    while (i < n && isdigit (buf[i]))
+    while (i < n && isdigit ((int)(unsigned char)buf[i]))
        ++i;
     *decpt = i;
 
@@ -126,7 +126,7 @@ APPEND (FUNC_PREFIX, fcvt_r) (FLOAT_TYPE value,
     if (i < n) {
        do
        ++i;
-       while (i < n && !isdigit (buf[i]));
+       while (i < n && !isdigit ((int)(unsigned char)buf[i]));
 
        if (*decpt == 1 && buf[0] == '0' && value != 0.0) {
           /* We must not have leading zeroes.  Strip them all out and
--- xinetd/libs/src/portable/inet_aton.c
+++ xinetd/libs/src/portable/inet_aton.c
@@ -103,11 +103,11 @@ inet_aton(const char *cp, struct in_addr *addr)
 {
 	register uint32_t val;
 	register int base, n;
-	register char c;
+	register int c;
 	unsigned int parts[4];
 	register unsigned int *pp = parts;
 
-	c = *cp;
+	c = (unsigned char)*cp;
 	for (;;) {
 		/*
 		 * Collect number up to ``.''.
@@ -118,20 +118,20 @@ inet_aton(const char *cp, struct in_addr *addr)
 			return (0);
 		val = 0; base = 10;
 		if (c == '0') {
-			c = *++cp;
+			c = (unsigned char)*++cp;
 			if (c == 'x' || c == 'X')
-				base = 16, c = *++cp;
+				base = 16, c = (unsigned char)*++cp;
 			else
 				base = 8;
 		}
 		for (;;) {
 			if (isascii(c) && isdigit(c)) {
 				val = (val * base) + (c - '0');
-				c = *++cp;
+				c = (unsigned char)*++cp;
 			} else if (base == 16 && isascii(c) && isxdigit(c)) {
 				val = (val << 4) |
 					(c + 10 - (islower(c) ? 'a' : 'A'));
-				c = *++cp;
+				c = (unsigned char)*++cp;
 			} else
 				break;
 		}
@@ -145,7 +145,7 @@ inet_aton(const char *cp, struct in_addr *addr)
 			if (pp >= parts + 3)
 				return (0);
 			*pp++ = val;
-			c = *++cp;
+			c = (unsigned char)*++cp;
 		} else
 			break;
 	}
--- xinetd/libs/src/portable/strcasecmp.c
+++ xinetd/libs/src/portable/strcasecmp.c
@@ -8,8 +8,8 @@ strcasecmp(s1, s2)
 	*us1 = (const u_char *)s1,
 	*us2 = (const u_char *)s2;
 
-	while (tolower(*us1) == tolower(*us2++))
+	while (tolower((int)*us1) == tolower((int)*us2++))
 		if (*us1++ == '\0')
 			return (0);
-	return (tolower(*us1) - tolower(*--us2));
+	return (tolower((int)*us1) - tolower((int)*--us2));
 }
--- xinetd/libs/src/sio/sprint.c
+++ xinetd/libs/src/sio/sprint.c
@@ -84,7 +84,7 @@ static char S_NULL[S_NULL_LEN+1] = "(null)";
 
 #define STR_TO_DEC( str, num )						\
 	num = NUM( *str++ ) ;						\
-	while ( isdigit( *str ) )					\
+	while ( isdigit( (int)(unsigned char)*str ) )			\
 	{								\
 		num *= 10 ;						\
 		num += NUM( *str++ ) ;					\
@@ -180,7 +180,7 @@ static char *conv_fp( char format, double num, boolean_e add_dp,
 	/*
 	 * Check for Infinity and NaN
 	 */
-	if ( isalpha( *p ) )
+	if ( isalpha( (int)(unsigned char)*p ) )
 	{
 		*len = strlen( strcpy( buf, p ) ) ;
 		*is_negative = FALSE ;
@@ -406,7 +406,8 @@ ssize_t __sio_converter( __sio_od_t *odp, int fd, const char *fmt, va_list ap )
 			/*
 			 * Try to avoid checking for flags, width or precision
 			 */
-			if ( isascii( *fmt ) && ! islower( *fmt ) )
+			if ( isascii( (int)(unsigned char)*fmt ) &&
+			    ! islower( (int)(unsigned char)*fmt ) )
 			{
 				/*
 				 * Recognize flags: -, #, BLANK, +
@@ -430,7 +431,7 @@ ssize_t __sio_converter( __sio_od_t *odp, int fd, const char *fmt, va_list ap )
 				/*
 				 * Check if a width was specified
 				 */
-				if ( isdigit( *fmt ) )
+				if ( isdigit( (int)(unsigned char)*fmt ) )
 				{
 					STR_TO_DEC( fmt, min_width ) ;
 					adjust_width = YES ;
@@ -456,7 +457,7 @@ ssize_t __sio_converter( __sio_od_t *odp, int fd, const char *fmt, va_list ap )
 				{
 					adjust_precision = YES ;
 					fmt++ ;
-					if ( isdigit( *fmt ) )
+					if ( isdigit( (int)(unsigned char)*fmt ) )
 					{
 						STR_TO_DEC( fmt, precision ) ;
 					}
--- xinetd/libs/src/str/strutil.c
+++ xinetd/libs/src/str/strutil.c
@@ -25,7 +25,7 @@
  */
 char *str_casefind( register char *str, char *sstr )
 {
-	register int ssfc = *sstr++ ;		/* sub-string first char */
+	register int ssfc = (unsigned char)*sstr++ ; /* sub-string first char */
 
 	if ( ssfc == 0 )
 		return( str ) ;
@@ -36,7 +36,7 @@ char *str_casefind( register char *str, char *sstr )
 	while ( *str )
 	{
 		char *current = str ;
-		register int strc = *str++ ;
+		register int strc = (unsigned char)*str++ ;
 		char *sp ;							/* string pointer */
 		char *ssp ;							/* sub-string pointer */
 
@@ -47,8 +47,8 @@ char *str_casefind( register char *str, char *sstr )
 		
 		for ( sp = str, ssp = sstr ;; sp++, ssp++ )
 		{
-			register int sc = *sp ;				/* string char */
-			register int ssc = *ssp ;			/* substring char */
+			register int sc = (unsigned char)*sp ;		/* string char */
+			register int ssc = (unsigned char)*ssp ;	/* substring char */
 
 			/*
 			 * End-of-substring means we got a match
--- xinetd/xinetd/addr.c
+++ xinetd/xinetd/addr.c
@@ -276,7 +276,7 @@ int check_hostname( const char *addr )
 
    for (i = 0; addr[i]; ++i)
    {
-      if ( !isdigit(addr[i]) && (addr[i] != '.') )
+      if ( !isdigit((int)(unsigned char)addr[i]) && (addr[i] != '.') )
          return 1;
    }
    return 0;
@@ -641,7 +641,7 @@ static result_e factorized_addr( const char *str_addr,
 
    for ( i = 0 ; str_addr[i] != OPEN_CURLY_BRACKET ; last = str_addr[i++] )
    {
-      if ( isdigit( str_addr[i] ) )
+      if ( isdigit( (int)(unsigned char)str_addr[i] ) )
       {
          num = num * 10 + str_addr[i] - '0' ;
          continue ;
@@ -680,7 +680,7 @@ static result_e factorized_addr( const char *str_addr,
       num = 0 ;
       for ( i = i+1, last = COMMA ;; last = str_addr[i++] )
       {
-         if ( isdigit( str_addr[i] ) )
+         if ( isdigit( (int)(unsigned char)str_addr[i] ) )
          {
             num = num * 10 + str_addr[i] - '0' ;
             continue ;
--- xinetd/xinetd/connection.c
+++ xinetd/xinetd/connection.c
@@ -218,11 +218,7 @@ void conn_dump( const connection_s *cp, int fd )
 
    tabprint( fd, 1, "service = %s\n", SVC_ID( cp->co_sp ) ) ;
    tabprint( fd, 1, "descriptor = %d\n", cp->co_descriptor ) ;
-#if defined(__GNUC__) && !defined(__arch64__) && !defined(__alpha__)
-   tabprint( fd, 1, "flags = %#llx\n", cp->co_flags ) ;
-#else
-   tabprint( fd, 1, "flags = %#lx\n", cp->co_flags ) ;
-#endif
+   tabprint( fd, 1, "flags = %#llx\n", (unsigned long long)cp->co_flags ) ;
    tabprint( fd, 1, "remote_address = %s,%d\n", name,
                               ntohs( cp->co_remote_address.sa_in.sin_port ) ) ;
 }
--- xinetd/xinetd/ident.c
+++ xinetd/xinetd/ident.c
@@ -241,7 +241,7 @@ static char *verify_line( char *line,
       unsigned int line_id_len = strlen( line_id ) ;
 
       start = p+1 ;
-      for ( p = start ; isspace( *p ) ; p++ ) ;
+      for ( p = start ; isspace( (int)(unsigned char)*p ) ; p++ ) ;
       if ( *p == NUL )
          return( NULL ) ;
       start = p ;
@@ -250,10 +250,10 @@ static char *verify_line( char *line,
       start += line_id_len ;      /* skip it */
    }
 
-   for ( p = start ; isspace( *p ) ; p++ ) ;      /* skip any white-space */
+   for ( p = start ; isspace( (int)(unsigned char)*p ) ; p++ ) ; /* skip any white-space */
    if ( *p != ':' )
       return( NULL ) ;
-   for ( p++ ; isspace( *p ) ; p++ ) ;
+   for ( p++ ; isspace( (int)(unsigned char)*p ) ; p++ ) ;
    if ( *p == NUL )
       return( NULL ) ;
    return( p ) ;
--- xinetd/xinetd/itox.c
+++ xinetd/xinetd/itox.c
@@ -31,8 +31,8 @@ str_h strp ;
 int line_count ;
 static void print_line( const char *name, const char *value );
 static char *next_word( const char *description );
-static char *make_string_cat( register unsigned count, ... );
-static char *make_pathname( register unsigned count, ... );
+static char *make_string_cat( unsigned count, ... );
+static char *make_pathname( unsigned count, ... );
 
 
 /*
@@ -219,7 +219,7 @@ static char *next_word( const char *description )
 	return( word ) ;
 }
 
-static char *make_string_cat( register unsigned count, ... )
+static char *make_string_cat( unsigned count, ... )
 {
    va_list ap ;
    register unsigned i ;
@@ -268,7 +268,7 @@ static char *make_string_cat( register unsigned count, ... )
    return newstring ;
 }
 
-static char *make_pathname( register unsigned count, ... )
+static char *make_pathname( unsigned count, ... )
 {
    va_list ap ;
    register unsigned i ;
--- xinetd/xinetd/parsers.c
+++ xinetd/xinetd/parsers.c
@@ -793,7 +793,7 @@ static int get_limit( char *limit_str, rlim_t *res )
    }
 
    p = limit_str + strlen( limit_str ) - 1;
-   while ( p > limit_str && isspace( *p ) )
+   while ( p > limit_str && isspace( (int)(unsigned char)*p ) )
       p--;
 
    if (*p == 'k' || *p == 'K') {
--- xinetd/xinetd/parsesup.c
+++ xinetd/xinetd/parsesup.c
@@ -39,7 +39,7 @@ char *next_line( int fd )
       for ( p = line ;; p++ )
          if ( *p == NUL || *p == COMMENT_BEGIN )
             break ;                                /* skip this line */
-         else if ( isspace( *p ) )
+         else if ( isspace( (int)(unsigned char)*p ) )
             continue ;                             /* skip white space */
          else
             return( line ) ;
@@ -69,7 +69,7 @@ static char *get_attr_op( char *line, char **attrp, enum assign_op *opp )
    /*
     * First get the attribute name
     */
-   for ( p = line ; isspace( *p ) ; p++ ) ;      /* skip spaces */
+   for ( p = line ; isspace( (int)(unsigned char)*p ) ; p++ ) ; /* skip spaces */
    if ( *p == NUL )
    {
       parsemsg( LOG_ERR, func, "Empty line" ) ;
@@ -77,7 +77,7 @@ static char *get_attr_op( char *line, char **attrp, enum assign_op *opp )
    }
 
    attr = p ;
-   for ( ; ! isspace( *p ) && (*p != '='); p++ ) ;            /* skip attribute name */
+   for ( ; ! isspace( (int)(unsigned char)*p ) && (*p != '='); p++ ) ; /* skip attribute name */
    if ( *p == NUL )
    {
       parsemsg( LOG_ERR, func, "Nothing after attribute: %s", attr ) ;
@@ -90,7 +90,7 @@ static char *get_attr_op( char *line, char **attrp, enum assign_op *opp )
    }
    *p++ = NUL ;         /* now attribute name is NUL terminated */
 
-   while ( isspace( *p ) ) p++ ;      /* skip spaces */
+   while ( isspace( (int)(unsigned char)*p ) ) p++ ; /* skip spaces */
 
    switch ( *p )
    {
@@ -200,7 +200,7 @@ int line_has_only_1_char( const char *line, char ch )
    for ( p = line ; *p ; p++ )
       if ( *p == target_char )
          target_char = NUL ;
-      else if ( ! isspace( *p ) )
+      else if ( ! isspace( (int)(unsigned char)*p ) )
          return( FALSE ) ;
    return( target_char != ch ) ;
 }
--- xinetd/xinetd/sensor.c
+++ xinetd/xinetd/sensor.c
@@ -100,21 +100,22 @@ void process_sensor( const struct service *sp, const union xsockaddr *addr)
 	 {
 	    /* Here again, eh?...update time stamp. */
             char *exp_time;
-	    time_t stored_time;
+	    int stored_time;
 
 	    item_matched--; /* Is # plus 1, to even get here must be >= 1 */
             exp_time = pset_pointer( global_no_access_time, item_matched ) ;
             if (exp_time == NULL)
                return ;
 
-            if ( parse_base10(exp_time, (int *)&stored_time) )
+            if ( parse_base10(exp_time, &stored_time) == 0)
             {  /* if never let them off, bypass */
                if (stored_time != -1)
                {
                   time_t nowtime, new_time;
 
                   nowtime = time(NULL);
-                  new_time = (time_t)nowtime+(60*SC_DENY_TIME(SVC_CONF(sp)));                     if (difftime(new_time, (time_t)stored_time) > 0.0)
+                  new_time = (time_t)nowtime+(60*SC_DENY_TIME(SVC_CONF(sp)));
+		  if (difftime(new_time, (time_t)stored_time) > 0.0)
 	          {   /* new_time is longer save it   */
 		     char time_buf[40], *new_exp_time;
 
@@ -168,12 +169,14 @@ static void scrub_global_access_list( void )
       for (u=0; u < count; u++)
       {
          char *exp_time;
-         time_t stored_time;
+         int stored_time;
 	 
 	 exp_time = pset_pointer( global_no_access_time, u ) ;
-         stored_time = atol(exp_time);
 
-	 if (stored_time == -1)   /* never let them off   */
+	 if (exp_time == NULL)
+	    continue;
+
+	 if (parse_base10(exp_time, &stored_time) || stored_time == -1)   /* never let them off   */
 	    continue;
 
 	 if (difftime(nowtime, (time_t)stored_time) >= 0.0)
--- xinetd/xinetd/time.c
+++ xinetd/xinetd/time.c
@@ -66,7 +66,7 @@ static int get_num( int *nump,
    const char *func = "get_num" ;
    int i = 0;
 
-   for ( *nump = 0 ; isdigit( s[i] ) ; i++ )
+   for ( *nump = 0 ; isdigit( (int)(unsigned char)s[i] ) ; i++ )
    {
       *nump *= 10 ;
       *nump += s[i] - '0' ;
--- xinetd/xinetd/util.c
+++ xinetd/xinetd/util.c
@@ -39,6 +39,7 @@
 #include <memory.h>
 #include <syslog.h>
 #include <errno.h>
+#include <limits.h>
 
 #include "sio.h"
 #include "str.h"
@@ -275,10 +276,12 @@ int parse_int(const char *str, int base, int term, int *res)
 	errno = 0;
 	strtol_res = strtol(str, (char **)&endptr, base);
 
-	if (errno == 0 && *str != NUL) {
+	if (errno == 0 && *str != NUL &&
+	    strtol_res >= INT_MIN && strtol_res <= INT_MAX) {
 		/* Special case: -1 means allow trailing whitespace */
 		if (term == -1) {
-			while (*endptr != NUL && isspace(*endptr))
+			while (*endptr != NUL &&
+			    isspace((int)(unsigned char)*endptr))
 				endptr++;
 			term = NUL;
 		}
@@ -298,7 +301,15 @@ int parse_uint(const char *str, int base, int term, unsigned int *res)
 	unsigned long long tmp;
 	int ret;
 	ret = parse_ull(str, base, term, &tmp);
-	*res = (unsigned int)tmp;
+	if (!ret) {
+		/* This kind of check is only valid for unsigned types */
+		if ((unsigned int)tmp == tmp)
+			*res = (unsigned int)tmp;
+		else
+			ret = -1;
+	}
+	if (ret)
+		*res = 0;
 	return ret;
 }
 
@@ -317,7 +328,8 @@ int parse_ull(const char *str, int base, int term, unsigned long long *res)
 	if (errno == 0 && *str != NUL) {
 		/* Special case: -1 means allow trailing whitespace */
 		if (term == -1) {
-			while (*endptr != NUL && isspace(*endptr))
+			while (*endptr != NUL &&
+			    isspace((int)(unsigned char)*endptr))
 				endptr++;
 			term = NUL;
 		}
@@ -344,12 +356,8 @@ int parse_base10(const char *str, int *res)
 
 bool_int parse_all_digits(const char *ptr)
 {
-	size_t num=0, len = strlen(ptr);
-
-	while (isdigit(*ptr++))
-		num++;
-	if (num == len)
-		return TRUE;
-	else
-		return FALSE;
+	while (*ptr)
+		if (!isdigit((int)(unsigned char)*ptr++))
+			return FALSE;
+	return TRUE;
 }
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin