OSSP CVS Repository

ossp - Ticket #21
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Attach]  [Edit]  [History

Ticket 21: sa_addr_u2a does dumps core on freebsd 4.8

The problem exists on freebsd 4.8 stable, gcc 2.95.4. When I am trying to use sa_addr_u2a in the simplest form, with "inet" protocol (without specifying tcp or udp), I get a core dump. The insulting code seems to be on line 658 of sa.c. I am trying with the following piece of code:

	#include <stdio.h>
	#include <sa.h>
	main(){
		sa_addr_t *saa;
		sa_rc_t rct;
		rct = sa_addr_u2a(saa, "inet://127.0.0.1:smtp");
		if (rct != SA_OK)
			fprintf(stderr, "%s\n", sa_error(rct));
		exit(rct);
	}

A run with gdb shows the following:

	Starting program: /root/devel/tmp/a.out 
	a.out in free(): warning: junk pointer, too high to make sense

	Program received signal SIGBUS, Bus error.
	0x28067d33 in sa_addr_u2a (saa=0x2804b461, uri=0xbfbff174 "inet://127.0.0.1")
	at sa.c:658

	658         if ((saa->saBuf = (struct sockaddr *)malloc((size_t)sl)) == NULL)

Also note the warning about the free() call on line 657. I have not tried calling other functions (i.e. sa_addr_a2u etc) but I can do that if you need me to.

[Append remarks]

Remarks:

Ooops, no sa_addr_create in that. Sorry.
[Append remarks]

Properties:

Type: code           Version: 1.0.5 
Status: closed          Created: 2003-Sep-17 15:47
Severity:          Last Change: 2003-Sep-17 16:52
Priority:          Subsystem: sa 
Assigned To: rse           Derived From:  
Creator: anonymous 

CVSTrac 2.0.1