diff -c xmbdfed-4.5-orig/bdf.h xmbdfed-4.5/bdf.h *** xmbdfed-4.5-orig/bdf.h Wed Sep 19 16:00:42 2001 --- xmbdfed-4.5/bdf.h Sat Feb 9 22:15:27 2002 *************** *** 41,47 **** #ifdef HAVE_FREETYPE #include ! #include #endif /* HAVE_FREETYPE */ #ifdef __cplusplus --- 41,47 ---- #ifdef HAVE_FREETYPE #include ! #include #endif /* HAVE_FREETYPE */ #ifdef __cplusplus diff -c xmbdfed-4.5-orig/bdfgname.c xmbdfed-4.5/bdfgname.c *** xmbdfed-4.5-orig/bdfgname.c Wed Sep 19 16:00:43 2001 --- xmbdfed-4.5/bdfgname.c Sat Feb 9 22:14:36 2002 *************** *** 40,45 **** --- 40,89 ---- static unsigned long adobe_names_size; static unsigned long adobe_names_used; + /* + * Provide a maximum length for glyph names just to make things clearer. + */ + #define MAX_GLYPH_NAME_LEN 127 + + static int + #ifdef __STDC__ + getline(FILE *in, char *buf, int limit) + #else + getline(in, buf, limit) + FILE *in; + char *buf; + int limit; + #endif + { + int c, i; + + c = EOF; + + for (i = 0; i < limit - 1; i++) { + if ((c = getc(in)) == EOF || (c == '\n' || c == '\r')) + break; + buf[i] = c; + } + buf[i] = 0; + + /* + * Discard the rest of the line which did not fit into the buffer. + */ + while (c != EOF && c != '\n' && c != '\r') + c = getc(in); + + if (c == '\r') { + /* + * Check for a trailing newline. + */ + c = getc(in); + if (c != '\n') + ungetc(c, in); + } + + return i; + } + static long #ifdef __STDC__ _bdf_find_name(long code, char *name, FILE *in) *************** *** 51,65 **** #endif { long c, i, pos; ! char *sp, buf[128]; while (!feof(in)) { pos = ftell(in); ! fscanf(in, "%[^\n]\n", buf); while (!feof(in) && (buf[0] == 0 || buf[0] == '#')) { buf[0] = 0; pos = ftell(in); ! fscanf(in, "%[^\n]\n", buf); } if (buf[0] == 0) --- 95,109 ---- #endif { long c, i, pos; ! char *sp, buf[256]; while (!feof(in)) { pos = ftell(in); ! (void) getline(in, buf, 256); while (!feof(in) && (buf[0] == 0 || buf[0] == '#')) { buf[0] = 0; pos = ftell(in); ! (void) getline(in, buf, 256); } if (buf[0] == 0) *************** *** 79,85 **** if (c == code) { for (sp = buf; *sp != ';'; sp++) ; sp++; ! for (i = 0; *sp != ';'; sp++, i++) name[i] = *sp; name[i] = 0; return i; --- 123,129 ---- if (c == code) { for (sp = buf; *sp != ';'; sp++) ; sp++; ! for (i = 0; *sp != ';' && i < MAX_GLYPH_NAME_LEN; sp++, i++) name[i] = *sp; name[i] = 0; return i; *************** *** 116,122 **** #endif { long c, pos; ! char *sp, buf[128]; /* * Go back to the beginning of the file to look for the code because the --- 160,166 ---- #endif { long c, pos; ! char *sp, buf[256]; /* * Go back to the beginning of the file to look for the code because the *************** *** 126,136 **** while (!feof(in)) { pos = ftell(in); ! fscanf(in, "%[^\n]\n", buf); while (!feof(in) && (buf[0] == 0 || buf[0] == '#')) { buf[0] = 0; pos = ftell(in); ! fscanf(in, "%[^\n]\n", buf); } c = _bdf_atol(buf, 0, 16); --- 170,180 ---- while (!feof(in)) { pos = ftell(in); ! (void) getline(in, buf, 256); while (!feof(in) && (buf[0] == 0 || buf[0] == '#')) { buf[0] = 0; pos = ftell(in); ! (void) getline(in, buf, 256); } c = _bdf_atol(buf, 0, 16); *************** *** 209,214 **** --- 253,260 ---- else { fseek(in, adobe_names[m].start, 0); len = adobe_names[m].end - adobe_names[m].start; + if (len > MAX_GLYPH_NAME_LEN) + len = MAX_GLYPH_NAME_LEN; len = (long) fread(name, sizeof(char), len, in); name[len] = 0; return len; *************** *** 235,241 **** long i, size, len; bdf_glyph_t *gp; bdf_callback_struct_t cb; ! char name[128]; if (callback != 0) { cb.reason = BDF_GLYPH_NAME_START; --- 281,287 ---- long i, size, len; bdf_glyph_t *gp; bdf_callback_struct_t cb; ! char name[MAX_GLYPH_NAME_LEN + 1]; if (callback != 0) { cb.reason = BDF_GLYPH_NAME_START; diff -c xmbdfed-4.5-orig/xmbdfed.man xmbdfed-4.5/xmbdfed.man *** xmbdfed-4.5-orig/xmbdfed.man Wed Sep 19 16:00:44 2001 --- xmbdfed-4.5/xmbdfed.man Sat Feb 9 22:14:36 2002 *************** *** 1,7 **** .\" .\" $Id: xmbdfed.man,v 1.16 2001/09/19 21:00:44 mleisher Exp $ .\" ! .TH XMBDFED 1 "07 September 2001" "X Version 11" .SH NAME xmbdfed \- Motif-based BDF font editor --- 1,7 ---- .\" .\" $Id: xmbdfed.man,v 1.16 2001/09/19 21:00:44 mleisher Exp $ .\" ! .TH XMBDFED 1 "27 November 2001" "X Version 11" .SH NAME xmbdfed \- Motif-based BDF font editor *************** *** 711,716 **** --- 711,718 ---- Rudolf Cejka for bug fixes and a suggestion. .br Baruch Even for a bug fix. + .br + Sergey Vlasov for bug fixes. .SH AUTHOR Mark Leisher