• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

POSIX.1 National Language Support API for MinGW


Commit MetaInfo

Revisión4e24f181b37cb89cefefdbb658024e2977206333 (tree)
Tiempo2007-08-18 03:18:38
AutorKeith Marshall <keithmarshall@user...>
CommiterKeith Marshall

Log Message

Avoid a potential segmentation fault.

Cambiar Resumen

Diferencia incremental

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
11 2007-08-17 Keith Marshall <keithmarshall@users.sourceforge.net>
22
3+ Avoid a potential segmentation fault.
4+
5+ * mcmerge.c (mc_merge): Don't blindly inspect data fields within
6+ the `curr' message record; `curr' may be NULL, so test it first.
7+
8+2007-08-17 Keith Marshall <keithmarshall@users.sourceforge.net>
9+
310 * man/gencat.man (TH): Correct section; s/MAN3EXT/MAN1EXT/
411
512 2007-08-16 Keith Marshall <keithmarshall@users.sourceforge.net>
--- a/mcmerge.c
+++ b/mcmerge.c
@@ -10,7 +10,7 @@
1010 * any single source file into its current internal dictionary.
1111 *
1212 * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
13- * Last modification: 12-May-2007
13+ * Last modification: 17-Aug-2007
1414 *
1515 *
1616 * This is free software. It is provided AS IS, in the hope that it may
@@ -146,7 +146,7 @@ struct msgdict *mc_merge( struct msgdict *cat, struct msgdict *input )
146146 dfprintf(( stderr, "Initialise message list at set %u message %u\n", mark->set, mark->msg ));
147147 }
148148 }
149- else if( curr->key == input->key )
149+ else if( curr && (curr->key == input->key) )
150150 {
151151 /* The input record refers to a message which is already present
152152 * in the current message list; the operation to be performed is
@@ -221,7 +221,7 @@ struct msgdict *mc_merge( struct msgdict *cat, struct msgdict *input )
221221 mark = input;
222222 }
223223 }
224- else
224+ else if( curr )
225225 {
226226 /* There is no existing reference with set and message numbers
227227 * matching the current input record; thus the input record must
@@ -253,6 +253,16 @@ struct msgdict *mc_merge( struct msgdict *cat, struct msgdict *input )
253253 dfprintf(( stderr, "before set %u message %u\n", curr->set, curr->msg ));
254254 input->link = curr;
255255 }
256+# ifdef DEBUG
257+ else
258+ {
259+ /* There is no `curr' record and the input record has not been
260+ * appended; this must be a delete request, with nothing to act on,
261+ * so we simply ignore it.
262+ */
263+ dfprintf(( stderr, "Ignore delete request for non-existent message\n" ));
264+ }
265+# endif
256266 }
257267
258268 else if( input->set && (input->base == NULL) )
@@ -366,4 +376,4 @@ struct msgdict *mc_merge( struct msgdict *cat, struct msgdict *input )
366376 return cat;
367377 }
368378
369-/* $RCSfile$Revision: 1.2 $: end of file */
379+/* $RCSfile$Revision: 1.3 $: end of file */