Author: Anar
Email: [EMAIL PROTECTED]
Message:
mnogosearch v3.2.1
i think i've found where is the problem in the code (sql.c) :

(gdb) next
2879                    Server.tag              
=strdup(UDM_EMPTY2NULL(UdmSQLValue(res,i,3)));
(gdb) next

Program received signal SIGSEGV, Segmentation fault.
0x400a39fd in __strdup (s=0x0) at strdup.c:42
42      strdup.c: No such file or directory.

well, the same would be with category and charset if they are empty in the table..
why do you use UDM_EMPTY2NULL ? cant strdup work with NULL argument

then, I've set tag,category and charset to some nonempty value in my table.
but there is still a segfault..

below is something from gdb, note plz:
1.basic_auth is empty in my table, why do program step  lines 2885-2891?
2. well, there is a call of UdmSQLValue in line 2893, but why it steps 
  twise thru this func? (the same in previous calls of func - lines 2877..and then)
3.well, proxy is empty also, and the same thing - segfault
  (now, unlike tag,charset or category i cant set some stupid value for proxy - there 
is NO proxy)



UdmLoadServerTable (Indexer=0x9195990, name=0xbfff3131 "servers2", flags=132) at 
sql.c:2885
2885                    if(Server.basic_auth){
(gdb)
2888                            basic_auth=(char*) 
UdmXmalloc(BASE64_LEN(strlen(Server.basic_auth)));
(gdb)
2889                            
udm_base64_encode(Server.basic_auth,basic_auth,strlen(Server.basic_auth));
(gdb)
2890                            Server.basic_auth=basic_auth;
(gdb)
2891                    }
(gdb)
2893                    Server.proxy            
=strdup(UDM_EMPTY2NULL(UdmSQLValue(res,i,8)));
(gdb)

Breakpoint 1, UdmSQLValue (res=0x918c8f0, i=0, j=8) at sql.c:2645
2645                            if(res->lmysqlrow==0){
(gdb) next
2646                                    mysql_data_seek(res->mysqlres,(my_ulonglong)0);
(gdb)
2651                    }else
(gdb)
2656                            res->mysqlrow=mysql_fetch_row(res->mysqlres);
(gdb)
2658                    res->lmysqlrow=i;
(gdb)
2659                    if(res->mysqlrow)return(res->mysqlrow[j]?res->mysqlrow[j]:"");
(gdb)
2678    }
(gdb)

Breakpoint 1, UdmSQLValue (res=0x918c8f0, i=0, j=8) at sql.c:2645
2645                            if(res->lmysqlrow==0){
(gdb)
2646                                    mysql_data_seek(res->mysqlres,(my_ulonglong)0);
(gdb)
2651                    }else
(gdb)
2656                            res->mysqlrow=mysql_fetch_row(res->mysqlres);
(gdb)
2658                    res->lmysqlrow=i;
(gdb)
2659                    if(res->mysqlrow)return(res->mysqlrow[j]?res->mysqlrow[j]:"");
(gdb)
2678    }
(gdb)

Program received signal SIGSEGV, Segmentation fault.
0x400a39fd in __strdup (s=0x0) at strdup.c:42
42      strdup.c: No such file or directory.
(gdb)

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.


in the version 3.1.19 it was made this way:

sql.c:2020:
                Server.url              =sql_value(db->res,i,1);
                Server.period           =UDM_ATOI(sql_value(db->res,i,2));
                Server.tag              =sql_value(db->res,i,3);
                Server.category         =sql_value(db->res,i,4);
                Server.charset          =sql_value(db->res,i,5);
                
strncpy(Server.lang,UDM_NULL2EMPTY(sql_value(db->res,i,6)),2);Server.lang[2]='\0';
                Server.basic_auth       =UDM_EMPTY2NULL(sql_value(db->res,i,7));
                
                if(Server.basic_auth){
                        char * basic_auth;
                        
                        basic_auth=(char*) 
UdmXmalloc(BASE64_LEN(strlen(Server.basic_auth)));
                        
udm_base64_encode(Server.basic_auth,basic_auth,strlen(Server.basic_auth));
                        Server.basic_auth=basic_auth;
                }
                
                Server.proxy            =UDM_EMPTY2NULL(sql_value(db->res,i,8));
                Server.proxy_port       =UDM_ATOI(sql_value(db->res,i,9));
                Server.proxy_basic_auth =UDM_EMPTY2NULL(sql_value(db->res,i,10));
                Server.maxhops          =UDM_ATOI(sql_value(db->res,i,11));
                Server.index            =UDM_ATOI(sql_value(db->res,i,12));
                Server.follow           =UDM_ATOI(sql_value(db->res,i,13));
                Server.deletebad        =UDM_ATOI(sql_value(db->res,i,14));

and it does work


 I am not C guru, of cause
so, something in my thougts may sound stupid

plz let me know what is a problem.

thnx


Reply: <http://www.mnogosearch.org/board/message.php?id=3282>

___________________________________________
If you want to unsubscribe send "unsubscribe general"
to [EMAIL PROTECTED]

Reply via email to