
There are two fixed-size buffers in this code path:
- getValueString's s[100]. This one is gaily overflowed, with sprintf(&s[strlen(s)], ...)
- fprint's s[200]. This one is not overflowed, but this overflow causes the syntax error, since fprint(f, ""%s"", getValueString(smiValue, smiType)); loses the trailing quote.
My workaround was to change them to s[500] and s[1000], respectively. A more robust workaround might be to output the trailing quote with a different fprint() call, so that a too-long value creates a valid perl program with invalid data. (I don't know if that's better or worse.)
If vasprintf() is available, fprint could use that to avoid a fixed-length buffer. I don't have any suggestions for getValueString's fixed-length buffer.
A good test case is POLICY-BASED-MANAGEMENT-MIB (RFC 4011)'s pmSchedDay.
Bill