axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From din...@apache.org
Subject svn commit: r618007 - in /webservices/axis2/trunk/c/util: src/base64.c src/base64_binary.c test/allocator/allocator_test.c test/allocator/test.doc
Date Sun, 03 Feb 2008 15:47:53 GMT
Author: dinesh
Date: Sun Feb  3 07:47:52 2008
New Revision: 618007

URL: http://svn.apache.org/viewvc?rev=618007&view=rev
Log:
fixed axis2c-961, null checking missed in base64_binary.c

Modified:
    webservices/axis2/trunk/c/util/src/base64.c
    webservices/axis2/trunk/c/util/src/base64_binary.c
    webservices/axis2/trunk/c/util/test/allocator/allocator_test.c
    webservices/axis2/trunk/c/util/test/allocator/test.doc

Modified: webservices/axis2/trunk/c/util/src/base64.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/base64.c?rev=618007&r1=618006&r2=618007&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/base64.c (original)
+++ webservices/axis2/trunk/c/util/src/base64.c Sun Feb  3 07:47:52 2008
@@ -98,6 +98,11 @@
     register const unsigned char *bufin;
     register int nprbytes;
 
+    if (!bufcoded)
+    {
+        return -1;
+    }
+
     bufin = (const unsigned char *) bufcoded;
     while (pr2six[*(bufin++)] <= 63);
 
@@ -135,6 +140,11 @@
     register const unsigned char *bufin;
     register unsigned char *bufout;
     register int nprbytes;
+
+    if (!bufcoded)
+    {
+        return -1;
+    }
 
     bufin = (const unsigned char *) bufcoded;
     while (pr2six[*(bufin++)] <= 63);

Modified: webservices/axis2/trunk/c/util/src/base64_binary.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/base64_binary.c?rev=618007&r1=618006&r2=618007&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/base64_binary.c (original)
+++ webservices/axis2/trunk/c/util/src/base64_binary.c Sun Feb  3 07:47:52 2008
@@ -25,6 +25,7 @@
     int plain_binary_len;
 };
 
+
 AXIS2_EXTERN axutil_base64_binary_t *AXIS2_CALL
 axutil_base64_binary_create(
     const axutil_env_t * env)
@@ -55,6 +56,7 @@
 
     AXIS2_ENV_CHECK(env, NULL);
     AXIS2_PARAM_CHECK(env->error, plain_binary, NULL);
+
     base64_binary = (axutil_base64_binary_t *) axutil_base64_binary_create(env);
     if (!base64_binary)
     {
@@ -118,6 +120,11 @@
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
+    if (!base64_binary)
+    {
+        return;
+    }
+
     if (base64_binary->plain_binary)
     {
         AXIS2_FREE(env->allocator, base64_binary->plain_binary);
@@ -138,7 +145,9 @@
     const unsigned char *plain_binary,
     int plain_binary_len)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    AXIS2_PARAM_CHECK(env->error, plain_binary, AXIS2_FAILURE);
+
     base64_binary->plain_binary =
         AXIS2_MALLOC(env->allocator, sizeof(unsigned char) * plain_binary_len);
     if (!base64_binary->plain_binary)
@@ -160,6 +169,7 @@
     const axutil_env_t * env,
     int *plain_binary_len)
 {
+    AXIS2_PARAM_CHECK(env->error, base64_binary, NULL);
     *plain_binary_len = base64_binary->plain_binary_len;
     return base64_binary->plain_binary;
 }
@@ -172,7 +182,8 @@
 {
     int plain_binary_len = 0;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, base64_binary, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, encoded_binary, AXIS2_FAILURE);
 
     plain_binary_len = axutil_base64_decode_len(encoded_binary);
     base64_binary->plain_binary =
@@ -197,6 +208,7 @@
 {
     char *encoded_binary = NULL;
     int encoded_binary_len = 0;
+    AXIS2_PARAM_CHECK(env->error, base64_binary, NULL);
 
     encoded_binary_len =
         axutil_base64_encode_len(base64_binary->plain_binary_len);
@@ -220,6 +232,11 @@
     const axutil_env_t * env)
 {
     int encoded_binary_len = 0;
+    if (!base64_binary)
+    {
+        return 0;
+    }
+
     encoded_binary_len =
         axutil_base64_encode_len(base64_binary->plain_binary_len);
     return encoded_binary_len;
@@ -230,5 +247,9 @@
     axutil_base64_binary_t * base64_binary,
     const axutil_env_t * env)
 {
+    if (!base64_binary)
+    {
+        return 0;
+    }
     return base64_binary->plain_binary_len;
 }

Modified: webservices/axis2/trunk/c/util/test/allocator/allocator_test.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/test/allocator/allocator_test.c?rev=618007&r1=618006&r2=618007&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/test/allocator/allocator_test.c (original)
+++ webservices/axis2/trunk/c/util/test/allocator/allocator_test.c Sun Feb  3 07:47:52 2008
@@ -22,6 +22,12 @@
       FILE *in = fopen("test","rb");
       FILE *out = fopen("test.doc","w");
 
+      if (!(in && out))
+      {
+          fprintf (stderr, "unable to open streams\n");
+          return -1;
+      }
+
       while((plain_binary_len = fread(buffer,1,sizeof(buffer),in)) > 0)
       {
          fwrite(buffer,1,plain_binary_len,out);
@@ -42,7 +48,9 @@
     read_binary(); 
     axutil_base64_binary_create(env);
     printf(" base64 binary created\n");
-    base64_binary = axutil_base64_binary_create_with_plain_binary(env,plain_binary,plain_binary_len);
+    base64_binary = axutil_base64_binary_create_with_plain_binary(env,
+                                                                  plain_binary,
+                                                                  plain_binary_len); 
     printf(" base64 binary created with plain binary\n"); 
     encoded_binary = axutil_base64_binary_get_encoded_binary(base64_binary,env);
     printf(" get encorded binary \n");

Modified: webservices/axis2/trunk/c/util/test/allocator/test.doc
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/test/allocator/test.doc?rev=618007&r1=618006&r2=618007&view=diff
==============================================================================
Binary files - no diff available.



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message