Subject: 'strings' does not handle overlaid programs (#182) Index: ucb/strings.c 2.11BSD Description: The strings program miscalculates the offset of the data segment in overlaid executables. Repeat-By: strings /unix | grep UNIX This should find the version/datestamp string present in the kernel. If it does not then the bug is present and the fix below needs to be installed. Fix: The problem was that the 'strings' program was not modified to pass an "extended exec header" to the N_DATOFF routine. A minor 'cosmetic' change was made (ftell is declared in stdio.h so there's no need for a redundant declaration in strings.c). Apply the following patch and reinstall the 'strings' program: 1) Save the patch below to /tmp/foo 2) patch -p0 < /tmp/foo 3) cd /usr/src/ucb 4) make strings 5) install -s strings /usr/ucb 6) rm /tmp/foo All updates/patches are available via anonymous ftp to ftp.iipo.gtegsc.com in the directory /2.11BSD ====cut here *** /usr/src/ucb/strings.c.old Mon Jan 10 22:39:27 1994 --- /usr/src/ucb/strings.c Fri Feb 25 21:50:21 1994 *************** *** 9,15 **** "@(#) Copyright (c) 1980 Regents of the University of California.\n\ All rights reserved.\n"; ! static char sccsid[] = "@(#)strings.c 5.1.1 (2.11BSD GTE) 1/1/94"; #endif #include --- 9,15 ---- "@(#) Copyright (c) 1980 Regents of the University of California.\n\ All rights reserved.\n"; ! static char sccsid[] = "@(#)strings.c 5.1.2 (2.11BSD GTE) 2/25/94"; #endif #include *************** *** 18,30 **** #include #include - long ftell(); - /* * strings */ ! struct exec header; char *infile = "Standard input"; int oflg; --- 18,28 ---- #include #include /* * strings */ ! struct xexec header; char *infile = "Standard input"; int oflg; *************** *** 77,89 **** fseek(stdin, (long) 0, L_SET); if (asdata || fread((char *)&header, sizeof header, 1, stdin) != 1 || ! N_BADMAG(header)) { fseek(stdin, (long) 0, L_SET); find((long) 100000000L); continue; } fseek(stdin, (long) N_DATOFF(header), L_SET); ! find((long) header.a_data); } while (argc > 0); } --- 75,87 ---- fseek(stdin, (long) 0, L_SET); if (asdata || fread((char *)&header, sizeof header, 1, stdin) != 1 || ! N_BADMAG(header.e)) { fseek(stdin, (long) 0, L_SET); find((long) 100000000L); continue; } fseek(stdin, (long) N_DATOFF(header), L_SET); ! find((long) header.e.a_data); } while (argc > 0); }