be a little bit more stringent in checking input strings
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Sun, 23 Dec 2001 17:37:53 +0000 (17:37 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Sun, 23 Dec 2001 17:37:53 +0000 (17:37 +0000)
ChangeLog.claws
configure.in
src/string_match.c

index a1ea5083e0866ce01a8038c9ebb1f9563659a353..275142770d4cd0f06a4aa825355ebe9d7a13c9d4 100644 (file)
@@ -1,3 +1,8 @@
+2001-12-23 [alfons]    0.6.6claws13
+       
+       * src/string_match.c
+               validate input strings a little bit more
+
 2001-12-23 [alfons]    0.6.6claws12
 
        * src/Makefile.am
 2001-12-23 [alfons]    0.6.6claws12
 
        * src/Makefile.am
index f4a26f69c1c9c54edd932d9fe3fd2a4d7b6d7ecd..aeebf2887f7589efd507a60c43bdc9937b97914e 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=6
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws12
+EXTRA_VERSION=claws13
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index 2e4ca3cca477e305a13549f497f9fa006c9ef75c..114fb593c414b5621ec237a831f981d6c285e9f1 100644 (file)
@@ -17,7 +17,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-
+#include <glib.h>
 #include "string_match.h"
 
 
 #include "string_match.h"
 
 
@@ -28,6 +28,9 @@ int string_match_regexp(char * txt, char * rexp,
        regex_t re;
        int problem;
 
        regex_t re;
        int problem;
 
+       g_return_val_if_fail(txt, 0);
+       g_return_val_if_fail(rexp, 0);
+
        problem = regcomp(&re, rexp, cflags);  
        if (problem == 0) {
                problem = regexec(&re, txt, size, matches, eflags);
        problem = regcomp(&re, rexp, cflags);  
        if (problem == 0) {
                problem = regexec(&re, txt, size, matches, eflags);
@@ -41,6 +44,9 @@ int string_remove_match(char * txt, char * rexp, int cflags, int eflags)
        regmatch_t matches[STRING_MATCH_MR_SIZE];
        int foundp;
 
        regmatch_t matches[STRING_MATCH_MR_SIZE];
        int foundp;
 
+       g_return_val_if_fail(txt, -1);
+       g_return_val_if_fail(rexp, -1);
+
        if (strlen(txt) > 0 && strlen(rexp) > 0) {
                foundp = string_match_regexp(txt, rexp, STRING_MATCH_MR_SIZE, 
                                             matches, cflags, eflags);
        if (strlen(txt) > 0 && strlen(rexp) > 0) {
                foundp = string_match_regexp(txt, rexp, STRING_MATCH_MR_SIZE, 
                                             matches, cflags, eflags);
@@ -66,6 +72,9 @@ int string_remove_all_matches(char * txt, char * rexp, int cflags, int eflags)
        int pos = 0;
        int pos0 = pos;
 
        int pos = 0;
        int pos0 = pos;
 
+       g_return_val_if_fail(txt, 0);
+       g_return_val_if_fail(rexp, 0);
+
        while (pos0 >= 0 && pos < strlen(txt) && strlen(txt) > 0) {
                /* printf("%s %d:%d\n", txt, pos0, pos); */
                pos0 = string_remove_match(txt + pos, rexp, cflags, eflags);
        while (pos0 >= 0 && pos < strlen(txt) && strlen(txt) > 0) {
                /* printf("%s %d:%d\n", txt, pos0, pos); */
                pos0 = string_remove_match(txt + pos, rexp, cflags, eflags);