[dia] Bug 436148 - More robustness parsing FIG header
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] Bug 436148 - More robustness parsing FIG header
- Date: Sun, 30 Jan 2011 20:48:29 +0000 (UTC)
commit 7cebf3c2e7d371dfd10d18f700e75dcef09c0367
Author: Hans Breuer <hans breuer org>
Date: Sun Jan 30 21:48:08 2011 +0100
Bug 436148 - More robustness parsing FIG header
plug-ins/xfig/xfig-import.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/plug-ins/xfig/xfig-import.c b/plug-ins/xfig/xfig-import.c
index 59a9392..1436b27 100644
--- a/plug-ins/xfig/xfig-import.c
+++ b/plug-ins/xfig/xfig-import.c
@@ -1255,6 +1255,7 @@ fig_read_meta_data(FILE *file, DiagramData *dia) {
gboolean
import_fig(const gchar *filename, DiagramData *dia, void* user_data) {
FILE *figfile;
+ char buf[BUFLEN];
int figmajor, figminor;
int i;
@@ -1273,7 +1274,8 @@ import_fig(const gchar *filename, DiagramData *dia, void* user_data) {
}
/* First check magic bytes */
- if (fscanf(figfile, "#FIG %d.%d\n", &figmajor, &figminor) != 2) {
+ if (fgets(buf, BUFLEN, figfile) == NULL ||
+ sscanf(buf, "#FIG %d.%d\n", &figmajor, &figminor) != 2) {
message_error(_("Doesn't look like a Fig file: %s\n"), strerror(errno));
fclose(figfile);
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]