We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Here is a patch to the above issues with sys_evail()
I found the issues while checking the function with valgrind.
*** org/lib_mysqludf_sys-master/lib_mysqludf_sys.c Thu Feb 21 02:39:07 2013 --- ./lib_mysqludf_sys.c Fri Jan 13 15:31:45 2023
*** 54,60 ****
#define LIBVERSION "lib_mysqludf_sys version 0.0.3"
! #ifdef WIN #define SETENV(name,value) SetEnvironmentVariable(name,value); #else #define SETENV(name,value) setenv(name,value,1); --- 54,60 ----
! #ifdef WIN64 #define SETENV(name,value) SetEnvironmentVariable(name,value); #else #define SETENV(name,value) setenv(name,value,1);
*** 373,378 **** --- 373,380 ---- unsigned int i=0; if(args->arg_count == 1 && args->arg_type[i]==STRING_RESULT){
initid->max_length= 65535;
initid->ptr= malloc(65535); return 0;
*** 385,390 **** --- 387,394 ---- void sys_eval_deinit( UDF_INIT *initid ){
*** 395,424 **** , char *error ){ FILE *pipe; ! char line[1024]; ! unsigned long outlen, linelen;
! result = malloc(1); ! outlen = 0;
pipe = popen(args->args[0], "r"); while (fgets(line, sizeof(line), pipe) != NULL) {
! linelen = strlen(line); ! result = realloc(result, outlen + linelen); ! strncpy(result + outlen, line, linelen); ! outlen = outlen + linelen; }
pclose(pipe);
! if (!(*result) || result == NULL) { ! *is_null = 1; ! } else { ! result[outlen] = 0x00; ! *length = strlen(result); ! } ! return result; }
--- 399,424 ---- , char *error ){ FILE *pipe; ! char line[1024], *out= result; ! unsigned long outlen;
! if (result == 0) /* Allocation failed */ ! { ! *is_null = 1; ! return 0; ! }
outlen = 0; pipe = popen(args->args[0], "r");
while (fgets(line, sizeof(line), pipe) != NULL) { ! out= strnmov(out, line, initid->max_length - outlen); ! outlen = out - result; }
! *length= outlen; return result; }
The text was updated successfully, but these errors were encountered:
Try patch from montywi ( mysqludf#35 )
b1e5e3e
No branches or pull requests
Here is a patch to the above issues with sys_evail()
I found the issues while checking the function with valgrind.
*** org/lib_mysqludf_sys-master/lib_mysqludf_sys.c Thu Feb 21 02:39:07 2013
--- ./lib_mysqludf_sys.c Fri Jan 13 15:31:45 2023
*** 54,60 ****
#define LIBVERSION "lib_mysqludf_sys version 0.0.3"
! #ifdef WIN
#define SETENV(name,value) SetEnvironmentVariable(name,value);
#else
#define SETENV(name,value) setenv(name,value,1);
--- 54,60 ----
#define LIBVERSION "lib_mysqludf_sys version 0.0.3"
! #ifdef WIN64
#define SETENV(name,value) SetEnvironmentVariable(name,value);
#else
#define SETENV(name,value) setenv(name,value,1);
*** 373,378 ****
--- 373,380 ----
unsigned int i=0;
if(args->arg_count == 1
&& args->arg_type[i]==STRING_RESULT){
strcpy(
*** 385,390 ****
--- 387,394 ----
void sys_eval_deinit(
UDF_INIT *initid
){
}
char* sys_eval(
UDF_INIT *initid
*** 395,424 ****
, char *error
){
FILE *pipe;
! char line[1024];
! unsigned long outlen, linelen;
! result = malloc(1);
! outlen = 0;
! linelen = strlen(line);
! result = realloc(result, outlen + linelen);
! strncpy(result + outlen, line, linelen);
! outlen = outlen + linelen;
}
! if (!(*result) || result == NULL) {
! *is_null = 1;
! } else {
! result[outlen] = 0x00;
! *length = strlen(result);
! }
!
return result;
}
--- 399,424 ----
, char *error
){
FILE *pipe;
! char line[1024], *out= result;
! unsigned long outlen;
! if (result == 0) /* Allocation failed */
! {
! *is_null = 1;
! return 0;
! }
outlen = 0;
pipe = popen(args->args[0], "r");
while (fgets(line, sizeof(line), pipe) != NULL) {
! out= strnmov(out, line, initid->max_length - outlen);
! outlen = out - result;
}
pclose(pipe);
! *length= outlen;
return result;
}
The text was updated successfully, but these errors were encountered: