Index: ord.c ================================================================== --- ord.c +++ ord.c @@ -227,16 +227,17 @@ if (base > maxbase) return bad_base; if (base == 0) return itoasc(val, buf_start, buf_end, newbuf); *ptr-- = 0; - while(val > 0) { + if (val == 0) *ptr-- = '0'; + else while(val > 0) { if (ptr < buf_start) return bad_overflow; word rem = val % base; val /= base; char out = baseref[rem]; - if (lowercase && base < imaxbase) + if (lowercase && base <= imaxbase) if (out >= 'A' && out <= 'Z') out += ('a' - 'A'); *ptr-- = out; }