Bug 6140 - badly formed loops in ndr_drsblobs.c
Summary: badly formed loops in ndr_drsblobs.c
Alias: None
Product: Samba 3.3
Classification: Unclassified
Component: Build environment (show other bugs)
Version: 3.3.1
Hardware: SGI IRIX
: P3 normal
Target Milestone: ---
Assignee: Samba Bugzilla Account
QA Contact: Samba QA Contact
Depends on:
Reported: 2009-02-25 12:33 UTC by Jim Brown
Modified: 2009-03-01 10:12 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Jim Brown 2009-02-25 12:33:14 UTC
Two loops in librpc/gen_hdr/ndr_drsblobs.c routine ndr_push_package_PrimaryKerberosCtr4 compile with warning cc-1183 (unsigned compared to zero).
Why is the upper limit of both loops zero (lines 1871 and 1886)?

This is the first of two similar loops:

                for (cntr_service_keys_0 = 0; cntr_service_keys_0 < 0; cntr_service_keys_0++) {
                        NDR_CHECK(ndr_push_package_PrimaryKerberosKey4(ndr, NDR_SCALARS, &r->service_keys[cntr_service_keys_0]));
Comment 1 Jim Brown 2009-02-25 14:54:27 UTC
The counter (num_service_keys) for field service_keys has a value(0) attribute in the drsblobs.idl file (line 308).
Does this mean that variable num_service_keys is always zero and can never take a non-zero value?

I guess this looping code is OK assuming the loop termination condition is supposed to be 0 and not r->num_service_keys.

The same applies for the earlier push of 0 instead of the r->num_service_keys variable.
Comment 2 Jelmer Vernooij 2009-03-01 10:12:16 UTC
Pidl will now no longer generate these loops but instead warn the user when compiling the IDL file.