due to rules of first 2 fields are (x*40) + y, if the first
component is 0 or 1, then the second component has to be 0..39
If the first component is 2, then the second component can be
anything.
* The initial packed field has the first two compenents included, as (x * 40) + y.
*/
if (first) {
- if (oid > (((unsigned long long) 1) << 60)) goto invalid_oid; /* avoid overflow */
+ if (first_component < 2) {
+ if (oid >= 40) goto invalid_oid;
+
+ } else {
+ if (oid > (((unsigned long long) 1) << 60)) goto invalid_oid; /* avoid overflow */
+ }
+
first = false;
oid += first_component * 40;
}