Bug 15438 - CID 1539212 causes real issue when output contains only newlines
Summary: CID 1539212 causes real issue when output contains only newlines
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: CTDB (show other bugs)
Version: 4.19.0rc1
Hardware: All All
: P5 regression (vote)
Target Milestone: ---
Assignee: Jule Anger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-30 01:26 UTC by Martin Schwenke
Modified: 2023-08-18 11:22 UTC (History)
1 user (show)

See Also:


Attachments
Patch for v4-19-test (7.47 KB, patch)
2023-08-07 23:57 UTC, Martin Schwenke
amitay: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Schwenke 2023-07-30 01:26:43 UTC
** CID 1539212:  Control flow issues  (NO_EFFECT)
/ctdb/event/event_tool.c: 216 in print_status_one()


________________________________________________________________________________________________________
*** CID 1539212:  Control flow issues  (NO_EFFECT)
/ctdb/event/event_tool.c: 216 in print_status_one()
210     
211     		/*
212     		 * Strip trailing newlines, they are clutter and
213     		 * interfere with multi-line detection
214     		 */
215     		p = len - 1;
>>>     CID 1539212:  Control flow issues  (NO_EFFECT)
>>>     This greater-than-or-equal-to-zero comparison of an unsigned value is always true. "p >= 0UL".  
216     		while (p >= 0 && output[p] == '\n') {
217     			output[p] = '\0';
218     			p--;
219     		}
220     
221     		/* If the output is a single line then print it inline */
Comment 1 Martin Schwenke 2023-07-30 01:28:25 UTC
Also note that documentation was not updated for recent output change, so this can also come in via this bug.
Comment 3 Samba QA Contact 2023-08-07 09:44:06 UTC
This bug was referenced in samba master:

f01a179abcb33d9da6097f5ae45c7e7df1bc0397
f87f02f6f99157601a6607927305e91835d45ab8
Comment 4 Martin Schwenke 2023-08-07 23:57:14 UTC
Created attachment 18033 [details]
Patch for v4-19-test
Comment 5 Amitay Isaacs 2023-08-14 05:42:54 UTC
Hi Jule,

This is ready for v4-19.

Thanks.
Comment 6 Jule Anger 2023-08-14 07:35:36 UTC
Pushed to autobuild-v4-19-test.
Comment 7 Samba QA Contact 2023-08-14 08:42:04 UTC
This bug was referenced in samba v4-19-test:

5b68f98cb7f20eeacf666c1ad7b6303bf488c5dd
b604e7b0b95ad0cedb695d84b91379aa107242a3
Comment 8 Jule Anger 2023-08-14 09:49:44 UTC
Closing out bug report.

Thanks!
Comment 9 Samba QA Contact 2023-08-18 11:22:10 UTC
This bug was referenced in samba v4-19-stable (Release samba-4.19.0rc3):

5b68f98cb7f20eeacf666c1ad7b6303bf488c5dd
b604e7b0b95ad0cedb695d84b91379aa107242a3