Bug 79630 - bad source code
bad source code
Status: CLOSED WONTFIX
Product: Red Hat Linux
Classification: Retired
Component: bdflush (Show other bugs)
8.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Florian La Roche
Jay Turner
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-12-14 05:14 EST by d.binderman
Modified: 2015-01-07 19:02 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-06-03 06:43:52 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description d.binderman 2002-12-14 05:14:47 EST
Description of problem:

Hello there,

I just tried to compile package bdflush-1.5-21 from Redhat 8.0.

Here are some of the compiler messages.

bdflush.c:74: warning: operation on `ptr' may be undefined
bdflush.c:79: warning: operation on `ptr' may be undefined

Here is a patch which fixes the messages.

*** ./bdflush.c.old	2002-11-22 14:48:05.000000000 +0000
--- ./bdflush.c	2002-11-22 14:48:55.000000000 +0000
***************
*** 71,82 ****
          ptr = dst[0] + strlen(dst[0]);
          for (count = 1; count < argc; count++) {
              if (dst[count] == ptr + 1)
!                 ptr += strlen(++ptr);
          }
          if (environ[0] == ptr + 1) {
              for (count = 0; environ[count]; count++)
                  if (environ[count] == ptr + 1)
!                     ptr += strlen(++ptr);
          }
          count = 0;
          for (ptr2 = dst[0]; ptr2 <= ptr; ptr2++) {
--- 71,88 ----
          ptr = dst[0] + strlen(dst[0]);
          for (count = 1; count < argc; count++) {
              if (dst[count] == ptr + 1)
!             {
!                 ++ptr;
!                 ptr += strlen( ptr);
!             }
          }
          if (environ[0] == ptr + 1) {
              for (count = 0; environ[count]; count++)
                  if (environ[count] == ptr + 1)
!                 {
!                     ++ptr;
!                     ptr += strlen( ptr);
!                 }
          }
          count = 0;
          for (ptr2 = dst[0]; ptr2 <= ptr; ptr2++) {


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


How reproducible:


Steps to Reproduce:
1.
2.
3.
    
Actual results:


Expected results:


Additional info:
Comment 1 Florian La Roche 2003-01-03 04:00:04 EST
This rpm is not anymore part of RHL.

greetings,

Florian La Roche
Comment 2 d.binderman 2003-01-03 15:03:55 EST
>This rpm is not anymore part of RHL.

I have no information to confirm or deny your claim.

The package is part of the current shipping version
of RH 8.0 for Intel, and presumably will form
part of any RH 8.0 for any other architecture / and or 8.1
and future versions of RH.

Could you please point me at a document/URL which shows which
part(s) of RH 8.0 are no longer supported since its release
a few months ago ?



Comment 3 Florian La Roche 2003-01-08 07:55:20 EST
ANSI requires that arguments to strlen() are only evaluated once.

greetings,

Florian La Roche
Comment 4 d.binderman 2003-01-08 17:37:09 EST
>ANSI requires that arguments to strlen() are only evaluated once

True, but irrelevant.

The problem is that there is an increment, *and* an
+= to the same variable, between sequence points.

K&R 2, section 2.12, page 53 & 54 in my copy, cover this.
 

Comment 5 Florian La Roche 2003-06-03 06:43:52 EDT
Indeed an error in the source, but I'll close it due to this rpm being removed
for future products.

greetings,

Florian La Roche

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