summaryrefslogtreecommitdiff
path: root/emulators/xbeeb/patches/patch-af
blob: 28876f767bfe5c90be643aebee5e441f0100982c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
$NetBSD: patch-af,v 1.1 2006/06/13 13:24:36 dsainty Exp $

Remove use of non-standard "a" modifier in scanf format.  Under non-Linux
systems it is more likely to just core.

--- src/InfFS.c.orig	2002-01-16 04:46:43.000000000 +1300
+++ src/InfFS.c	2006-06-04 13:36:52.000000000 +1200
@@ -1516,24 +1516,23 @@
 			if ( !access ( beebfile, R_OK ) &&
 						( cat_fp = fopen ( entry->d_name, "r" ))) {
 				if ( fgets ( buff, 79, cat_fp ) > 0 ) {
+					char locked[10];
 					/*
 					 * FIX ME
 					 * Check for errors from malloc and sscanf
 					 */
 					p = malloc ( sizeof ( FileInfoL ));
-					sscanf ( buff, "%*s %X %X %as",
-						&(p->info.LoadAddress), &(p->info.ExeAddress), &lock );
+					locked[0] = '\0';
+					sscanf ( buff, "%*s %X %X %9s",
+						&(p->info.LoadAddress), &(p->info.ExeAddress), locked);
 					p->info.StartSector = 0;
 					stat ( beebfile, &sb );
 					p->info.FileLength = sb.st_size;
-					if ( lock ) {
 #ifdef	XDFS
-						if ( !strncmp ( lock, "Locked", 6 )) {
-							p->info.LockFlag = 'L';
-						}
-#endif
-						free ( lock );
+					if ( !strncmp ( locked, "Locked", 6 )) {
+						p->info.LockFlag = 'L';
 					}
+#endif
 					/*
 					 * Filenames are right-padded with spaces initially.
 					 */