[comp.os.minix] commands/ascii.c : bug fix

V61%DHDURZ1.BITNET@cunyvm.cuny.edu (Ronald Lamprecht) (08/30/89)

Addresses should only be accessed if they are valid. Otherwise processors
like 680x0 may cause bus errors. But if you call 'ascii' without any
arguments (as a filter) a strcmp of a non-existing argument occurs, causing
trouble on the ST.

The fix is easy:
-----------------------------------cut here--------------------------------
*** ascii.c_13	Thu Aug 29 04:32:53 1989
--- ascii.c	Thu Aug 29 04:50:13 1989
***************
*** 19,25 ****
    char *p;

    if (argc > 3) usage();
!   if (strcmp(argv[1], "-n") == 0) nflag++;

    if ((argc == 2 && nflag == 0) || argc == 3) {
  	close(0);
--- 19,25 ----
    char *p;

    if (argc > 3) usage();
!   if (argc >= 2 && strcmp(argv[1], "-n") == 0) nflag++;

    if ((argc == 2 && nflag == 0) || argc == 3) {
  	close(0);
-------------------------------------end-----------------------------------

Note: Apply the patch by hand or use the -l option because HTABs may be
expanded (Sorry, but I'm on EBCDIC-Bitnet):

Bitnet:  V61@DHDURZ1                               Ronald Lamprecht
UUCP:    ...!unido!DHDURZ1.bitnet!V61              Theoretische Physik
ARPAnet: V61%DHDURZ1.BITNET@CUNYVM.CUNY.EDU       (Heidelberg, West Germany)