To: Eli Zaretskii cc: djgpp AT delorie DOT com, dan AT verity DOT ICS DOT UCI DOT EDU Subject: Re: novice errors? dpmi, info, groff, df In-reply-to: Your message of "Wed, 19 Mar 1997 12:29:28 +0300." Date: Wed, 19 Mar 1997 16:25:23 -0800 From: Dan Hirschberg Message-ID: <9703191625.aa02458@paris.ics.uci.edu> > ---------------------- statfs.c ---------------------------------- > /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ > #include > __dpmi_regs regs; > /* Get free space info */ > regs.h.ah = 0x36; /* DOS Get Free Disk Space call */ > regs.h.dl = drive_number + 1; > __dpmi_int(0x21, ®s); > > /* Check for errors */ > if ((regs.x.ax & 0xffff) == 0xffff) > { > errno = ENODEV; > return -1; > } > > /* Fill in the structure */ > buf->f_bavail = regs.x.bx; > buf->f_bfree = regs.x.bx; > buf->f_blocks = regs.x.dx; > buf->f_bsize = regs.x.cx * regs.x.ax; > buf->f_ffree = regs.x.bx; I note that regs.x.ax etc. are declared as unsigned short and it is possible that there is an integer overflow. Does regs.x.bx_hi have any meaning? It has value 11826. Similarly, regs.x.ax_hi = 8224 regs.x.cx_hi = 30049 regs.x.dx_hi = 28524 dan