[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs/kio/kio
From:       Waldo Bastian <bastian () kde ! org>
Date:       2002-12-07 16:39:47
[Download RAW message or body]

CVS commit by waba: 

Proper string handling. Patch by Peter Hawkins <peter@hawkins.emu.id.au>


  M +13 -4     lex.l   1.10


--- kdelibs/kio/kio/lex.l:1.9	Mon May  6 13:47:45 2002
@@ -58,9 +58,11 @@
 {
   int l = strlen( _name )-1;
   char *p = (char *)malloc( l );
-
-  strncpy( p, _name+1, l-1 );
-  p[l-1] = 0;
+  if (p != NULL)
+  {
+    strncpy( p, _name+1, l-1 );
+    p[l-1] = 0;
+  }
 
   return p;
 }
@@ -68,7 +70,10 @@
 char *KTraderParse_putSymbol( char *_name )
 {
   char *p = (char*)malloc( strlen( _name ) + 1 );
-  strcpy( p, _name );
+  if (p != NULL)
+  {
+      strcpy( p, _name );
+  }
   return p;
 }
 
@@ -78,6 +83,10 @@
   char *p = (char*)malloc( l );
   char *s = _str + 1;
   char *d = p;
+
+  if (p == NULL)
+    return NULL;
+
   while ( s != _str + l - 1 )
   {
      if ( *s != '\\' )

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic