mirror of
				https://github.com/MariaDB/server.git
				synced 2025-11-03 14:33:32 +03:00 
			
		
		
		
	udf: when banning paths from soname in CREATE FUNCTION, check for \ on windows.
when reporting an error, use an appropriate buffer for udf->name
This commit is contained in:
		@@ -190,7 +190,9 @@ void udf_init()
 | 
				
			|||||||
      This is done to ensure that only approved dll from the system
 | 
					      This is done to ensure that only approved dll from the system
 | 
				
			||||||
      directories are used (to make this even remotely secure).
 | 
					      directories are used (to make this even remotely secure).
 | 
				
			||||||
    */
 | 
					    */
 | 
				
			||||||
    if (strchr(dl_name, '/') || strlen(name) > NAME_LEN)
 | 
					    if (strchr(dl_name, '/') ||
 | 
				
			||||||
 | 
					        IF_WIN(strchr(dl_name, '\\'),0) ||
 | 
				
			||||||
 | 
					        strlen(name) > NAME_LEN)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      sql_print_error("Invalid row in mysql.func table for function '%.64s'",
 | 
					      sql_print_error("Invalid row in mysql.func table for function '%.64s'",
 | 
				
			||||||
                      name);
 | 
					                      name);
 | 
				
			||||||
@@ -219,7 +221,7 @@ void udf_init()
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    tmp->dlhandle = dl;
 | 
					    tmp->dlhandle = dl;
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      char buf[MAX_FIELD_NAME+16], *missing;
 | 
					      char buf[NAME_LEN+16], *missing;
 | 
				
			||||||
      if ((missing= init_syms(tmp, buf)))
 | 
					      if ((missing= init_syms(tmp, buf)))
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        sql_print_error(ER(ER_CANT_FIND_DL_ENTRY), missing);
 | 
					        sql_print_error(ER(ER_CANT_FIND_DL_ENTRY), missing);
 | 
				
			||||||
@@ -403,7 +405,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
 | 
				
			|||||||
    This is done to ensure that only approved dll from the system
 | 
					    This is done to ensure that only approved dll from the system
 | 
				
			||||||
    directories are used (to make this even remotely secure).
 | 
					    directories are used (to make this even remotely secure).
 | 
				
			||||||
  */
 | 
					  */
 | 
				
			||||||
  if (strchr(udf->dl, '/'))
 | 
					  if (strchr(udf->dl, '/') || IF_WIN(strchr(dl_name, '\\'),0))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    send_error(&thd->net, ER_UDF_NO_PATHS,ER(ER_UDF_NO_PATHS));
 | 
					    send_error(&thd->net, ER_UDF_NO_PATHS,ER(ER_UDF_NO_PATHS));
 | 
				
			||||||
    DBUG_RETURN(1);
 | 
					    DBUG_RETURN(1);
 | 
				
			||||||
@@ -433,7 +435,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
  udf->dlhandle=dl;
 | 
					  udf->dlhandle=dl;
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    char buf[MAX_FIELD_NAME+16], *missing;
 | 
					    char buf[NAME_LEN+16], *missing;
 | 
				
			||||||
    if ((missing= init_syms(udf, buf)))
 | 
					    if ((missing= init_syms(udf, buf)))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      net_printf(&thd->net, ER_CANT_FIND_DL_ENTRY, missing);
 | 
					      net_printf(&thd->net, ER_CANT_FIND_DL_ENTRY, missing);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user