Bug 2148869 - tcp_wrappers: Pointer truncation issue & C99 compatibility
Summary: tcp_wrappers: Pointer truncation issue & C99 compatibility
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: tcp_wrappers
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Florian Weimer
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PortingToModernCNoUpstream
TreeView+ depends on / blocked
 
Reported: 2022-11-28 08:32 UTC by Florian Weimer
Modified: 2022-11-28 08:49 UTC (History)
3 users (show)

Fixed In Version: tcp_wrappers-7.6-102.fc38
Clone Of:
Environment:
Last Closed: 2022-11-28 08:49:10 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
tcp_wrappers-inetcf-c99.patch (463 bytes, patch)
2022-11-28 08:48 UTC, Florian Weimer
no flags Details | Diff

Description Florian Weimer 2022-11-28 08:32:13 UTC
Last upstream release was in 1997 apparently, so I'm filing this bug here for tracking purposes.

Building in strict(er) C99 mode reveals an implicit declaration of malloc:

inetcf.c: In function 'inet_set':
inetcf.c:283:25: error: implicit declaration of function 'malloc'
  283 |     (struct inet_ent *) malloc(sizeof(struct inet_ent) + strlen(name));
      |                         ^~~~~~
inetcf.c:283:25: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
inetcf.c:23:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
   22 | #include "inetcf.h"
  +++ |+#include <stdlib.h>
   23 | 
inetcf.c: At top level:
inetcf.c:9:13: warning: 'sccsid' defined but not used [-Wunused-variable]
    9 | static char sccsid[] = "@(#) inetcf.c 1.7 97/02/12 02:13:23";
      |             ^~~~~~

This truncates the returned pointer to 32 bits, so this can never work. I think this code won't run in practice, so it's probably not a security issue.

Comment 1 Florian Weimer 2022-11-28 08:48:41 UTC
Created attachment 1927970 [details]
tcp_wrappers-inetcf-c99.patch


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