fixed NULL string mysql parameter
authorMartin Willi <martin@strongswan.org>
Thu, 5 Jun 2008 08:24:55 +0000 (08:24 -0000)
committerMartin Willi <martin@strongswan.org>
Thu, 5 Jun 2008 08:24:55 +0000 (08:24 -0000)
src/libstrongswan/plugins/mysql/mysql_database.c

index cef75c2..55f2b89 100644 (file)
@@ -274,7 +274,10 @@ static MYSQL_STMT* run(MYSQL *mysql, char *sql, va_list *args)
                                {
                                        bind[i].buffer_type = MYSQL_TYPE_STRING;;
                                        bind[i].buffer = va_arg(*args, char*);
-                                       bind[i].buffer_length = strlen(bind[i].buffer);
+                                       if (bind[i].buffer)
+                                       {
+                                               bind[i].buffer_length = strlen(bind[i].buffer);
+                                       }
                                        break;
                                }
                                case DB_BLOB: