Bug 77569 - bad source code
Summary: bad source code
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: tcp_wrappers
Version: 8.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Thomas Woerner
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-11-09 12:41 UTC by d.binderman
Modified: 2007-04-18 16:48 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-10-07 14:04:11 UTC
Embargoed:


Attachments (Terms of Use)

Description d.binderman 2002-11-09 12:41:25 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.6 [en-gb]C-CCK-MCD NetscapeOnline.co.uk  (Win98; I)

Description of problem:

Hello there,

I just tried to compile package tcp_wrappers-7.6-23 from Redhat 8.0.
Here are some of the following compiler warnings.

tcpd.c:134: warning: control reaches end of non-void function
hosts_access.c:146: warning: `sh_cmd' might be used uninitialized in this function
options.c:544: warning: control reaches end of non-void function
options.c:589: warning: suggest parentheses around assignment used as truth value
options.c:610: warning: `end' might be used uninitialized in this function
rfc931.c:219: warning: suggest parentheses around assignment used as truth value
fix_options.c:61: warning: `return' with no value, in function returning non-void
fix_options.c:104: warning: `return' with no value, in function returning non-void
fix_options.c:128: warning: control reaches end of non-void function
socket.c:186: warning: `salen' might be used uninitialized in this function
socket.c:186: warning: `alen' might be used uninitialized in this function
percent_m.c:30: warning: suggest parentheses around assignment used as truth value
fakelog.c:26: warning: control reaches end of non-void function
fakelog.c:40: warning: control reaches end of non-void function
fakelog.c:55: warning: control reaches end of non-void function
fakelog.c:62: warning: control reaches end of non-void function
inetcf.c:64: warning: `fp' might be used uninitialized in this function
tcpdchk.c:211: warning: suggest parentheses around assignment used as truth value
tcpdchk.c:337: warning: suggest parentheses around assignment used as truth value
tcpdchk.c:453: warning: suggest parentheses around assignment used as truth value

Here is a patch file which fixes these problems.

*** fakelog.c.old	2002-11-05 10:27:48.000000000 +0000
--- fakelog.c	2002-11-05 10:28:43.000000000 +0000
***************
*** 17,22 ****
--- 17,23 ----
  
  /* ARGSUSED */
  
+ void
  openlog(name, logopt, facility)
  char   *name;
  int     logopt;
***************
*** 27,32 ****
--- 28,34 ----
  
  /* vsyslog - format one record */
  
+ void
  vsyslog(severity, fmt, ap)
  int     severity;
  char   *fmt;
***************
*** 43,48 ****
--- 45,51 ----
  
  /* VARARGS */
  
+ void
  VARARGS(syslog, int, severity)
  {
      va_list ap;
***************
*** 56,61 ****
--- 59,65 ----
  
  /* closelog - dummy */
  
+ void
  closelog()
  {
      /* void */
*** fix_options.c.old	2002-11-05 10:24:56.000000000 +0000
--- fix_options.c	2002-11-05 10:25:32.000000000 +0000
***************
*** 32,37 ****
--- 32,38 ----
  
  /* fix_options - get rid of IP-level socket options */
  
+ void
  fix_options(request)
  struct request_info *request;
  {
*** hosts_access.c.old	2002-11-05 10:16:43.000000000 +0000
--- hosts_access.c	2002-11-05 10:17:06.000000000 +0000
***************
*** 143,149 ****
      FILE   *fp;
      char    sv_list[BUFLEN];		/* becomes list of daemons */
      char   *cl_list;			/* becomes list of clients */
!     char   *sh_cmd;			/* becomes optional shell command */
      int     match = NO;
      struct tcpd_context saved_context;
  
--- 143,149 ----
      FILE   *fp;
      char    sv_list[BUFLEN];		/* becomes list of daemons */
      char   *cl_list;			/* becomes list of clients */
!     char   *sh_cmd = 0;			/* becomes optional shell command */
      int     match = NO;
      struct tcpd_context saved_context;
  
*** inetcf.c.old	2002-11-05 10:28:54.000000000 +0000
--- inetcf.c	2002-11-05 10:29:10.000000000 +0000
***************
*** 61,67 ****
  char   *conf;
  {
      char    buf[BUFSIZ];
!     FILE   *fp;
      char   *service;
      char   *protocol;
      char   *user;
--- 61,67 ----
  char   *conf;
  {
      char    buf[BUFSIZ];
!     FILE   *fp = 0;
      char   *service;
      char   *protocol;
      char   *user;
*** options.c.old	2002-11-05 10:19:54.000000000 +0000
--- options.c	2002-11-05 10:20:45.000000000 +0000
***************
*** 541,546 ****
--- 541,547 ----
  	    return (t->value);
      tcpd_jump("bad syslog facility or severity: \"%s\"", name);
      /* NOTREACHED */
+     return 0;
  }
  
  /* severity_option - change logging severity for this event (Dave Mitchell) */
***************
*** 586,592 ****
      if (src[0] == 0)
  	return (0);
  
!     while (ch = *src) {
  	if (ch == ':') {
  	    if (*++src == 0)
  		tcpd_warn("rule ends in \":\"");
--- 587,593 ----
      if (src[0] == 0)
  	return (0);
  
!     while ((ch = *src) != 0) {
  	if (ch == ':') {
  	    if (*++src == 0)
  		tcpd_warn("rule ends in \":\"");
***************
*** 607,613 ****
  register char *string;
  {
      char   *start = 0;
!     char   *end;
      char   *cp;
  
      for (cp = string; *cp; cp++) {
--- 608,614 ----
  register char *string;
  {
      char   *start = 0;
!     char   *end = 0;
      char   *cp;
  
      for (cp = string; *cp; cp++) {
*** percent_m.c.old	2002-11-05 10:26:43.000000000 +0000
--- percent_m.c	2002-11-05 10:26:58.000000000 +0000
***************
*** 27,33 ****
      char   *bp = obuf;
      char   *cp = ibuf;
  
!     while (*bp = *cp)
  	if (*cp == '%' && cp[1] == 'm') {
  	    if (errno < sys_nerr && errno > 0) {
  		strcpy(bp, sys_errlist[errno]);
--- 27,33 ----
      char   *bp = obuf;
      char   *cp = ibuf;
  
!     while ((*bp = *cp) != 0)
  	if (*cp == '%' && cp[1] == 'm') {
  	    if (errno < sys_nerr && errno > 0) {
  		strcpy(bp, sys_errlist[errno]);
*** rfc931.c.old	2002-11-05 10:21:58.000000000 +0000
--- rfc931.c	2002-11-05 10:22:15.000000000 +0000
***************
*** 216,222 ****
  		     * protocol, not part of the data.
  		     */
  
! 		    if (cp = strchr(user, '\r'))
  			*cp = 0;
  		    result = user;
  		}
--- 216,222 ----
  		     * protocol, not part of the data.
  		     */
  
! 		    if ((cp = strchr(user, '\r')) != 0)
  			*cp = 0;
  		    result = user;
  		}
*** socket.c.old	2002-11-05 10:25:56.000000000 +0000
--- socket.c	2002-11-05 10:26:11.000000000 +0000
***************
*** 183,189 ****
      struct sockaddr *sin = host->sin;
      struct sockaddr_in sin4;
      struct addrinfo hints, *res, *res0 = NULL;
!     int salen, alen, err = 1;
      char *ap = NULL, *rap, hname[NI_MAXHOST];
  
      if (sin != NULL) {
--- 183,189 ----
      struct sockaddr *sin = host->sin;
      struct sockaddr_in sin4;
      struct addrinfo hints, *res, *res0 = NULL;
!     int salen = 0, alen = 0, err = 1;
      char *ap = NULL, *rap, hname[NI_MAXHOST];
  
      if (sin != NULL) {
*** tcpd.c.old	2002-11-05 10:07:20.000000000 +0000
--- tcpd.c	2002-11-05 10:31:34.000000000 +0000
***************
*** 131,134 ****
--- 131,136 ----
      syslog(LOG_ERR, "error: cannot execute %s: %m", path);
      clean_exit(&request);
      /* NOTREACHED */
+ 
+     return 0;
  }
*** tcpdchk.c.old	2002-11-05 10:29:24.000000000 +0000
--- tcpdchk.c	2002-11-05 10:30:06.000000000 +0000
***************
*** 208,214 ****
  
      saved_context = tcpd_context;		/* stupid compilers */
  
!     if (fp = fopen(table, "r")) {
  	tcpd_context.file = table;
  	tcpd_context.line = 0;
  	while (xgets(sv_list, sizeof(sv_list), fp)) {
--- 208,214 ----
  
      saved_context = tcpd_context;		/* stupid compilers */
  
!     if ((fp = fopen(table, "r")) != 0) {
  	tcpd_context.file = table;
  	tcpd_context.line = 0;
  	while (xgets(sv_list, sizeof(sv_list), fp)) {
***************
*** 334,340 ****
  	    clients = 0;
  	} else {
  	    clients++;
! 	    if (host = split_at(cp + 1, '@')) {	/* user@host */
  		check_user(cp);
  		check_host(host);
  	    } else {
--- 334,340 ----
  	    clients = 0;
  	} else {
  	    clients++;
! 	    if ((host = split_at(cp + 1, '@')) != 0) {	/* user@host */
  		check_user(cp);
  		check_host(host);
  	    } else {
***************
*** 450,456 ****
  	tcpd_warn("netgroup support disabled");
  #endif
  #endif
!     } else if (mask = split_at(pat, '/')) {	/* network/netmask */
  #ifdef INET6
  	int mask_len;
  
--- 450,456 ----
  	tcpd_warn("netgroup support disabled");
  #endif
  #endif
!     } else if ((mask = split_at(pat, '/')) != 0) {	/* network/netmask */
  #ifdef INET6
  	int mask_len;
  


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Compile package
2.
3.
	

Additional info:

Comment 1 Thomas Woerner 2004-10-07 14:04:11 UTC
Please verify this with a newer version of Red Hat Enterprise Linux or
Fedora Core and reopen it against the new version if it still occurs.

Closing as "not a bug" for now.



Note You need to log in before you can comment on or make changes to this bug.