Bug 79630 - bad source code
Summary: bad source code
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: bdflush
Version: 8.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Florian La Roche
QA Contact: Jay Turner
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-12-14 10:14 UTC by d.binderman
Modified: 2015-01-08 00:02 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2003-06-03 10:43:52 UTC
Embargoed:


Attachments (Terms of Use)

Description d.binderman 2002-12-14 10:14:47 UTC
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 09:00:04 UTC
This rpm is not anymore part of RHL.

greetings,

Florian La Roche


Comment 2 d.binderman 2003-01-03 20:03:55 UTC
>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 12:55:20 UTC
ANSI requires that arguments to strlen() are only evaluated once.

greetings,

Florian La Roche


Comment 4 d.binderman 2003-01-08 22:37:09 UTC
>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 10:43:52 UTC
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.