[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Linphone-developers] coreapi/sal_eXosip2_sdp.c keywordcmp bug
From: |
Sami Farin |
Subject: |
[Linphone-developers] coreapi/sal_eXosip2_sdp.c keywordcmp bug |
Date: |
Tue, 12 Mar 2013 21:29:08 +0200 |
User-agent: |
Mutt/1.5.21+146 (302044b4ed3f) (2012-12-30) |
#define keywordcmp(key,b) strncmp(key,b,sizeof(key))
two callers pass a pointer to it, giving sizeof 4 or 8.
my suggestion is something like this.
diff --git a/coreapi/sal_eXosip2_sdp.c b/coreapi/sal_eXosip2_sdp.c
index 9297077..2c7b843 100644
--- a/coreapi/sal_eXosip2_sdp.c
+++ b/coreapi/sal_eXosip2_sdp.c
@@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
#include <eXosip2/eXosip.h>
#define keywordcmp(key,b) strncmp(key,b,sizeof(key))
+#define keywordcmp_ptr(key,b) strncmp(key,b,strlen(key)+1)
#ifdef FOR_LATER
@@ -63,7 +64,7 @@ static const char
*sdp_message_a_attr_value_get_with_pt(sdp_message_t *sdp,int p
char *tmp;
sdp_attribute_t *attr;
for (i=0;(attr=sdp_message_attribute_get(sdp,pos,i))!=NULL;i++){
- if (keywordcmp(field,attr->a_att_field)==0 &&
attr->a_att_value!=NULL){
+ if (keywordcmp_ptr(field,attr->a_att_field)==0 &&
attr->a_att_value!=NULL){
int nb = sscanf(attr->a_att_value,"%i
%n",&tmppt,&scanned);
/* the return value may depend on how %n is interpreted
by the libc: see manpage*/
if (nb == 1 || nb==2 ){
@@ -85,7 +86,7 @@ static const char *sdp_message_a_attr_value_get(sdp_message_t
*sdp,int pos,const
int i;
sdp_attribute_t *attr;
for (i=0;(attr=sdp_message_attribute_get(sdp,pos,i))!=NULL;i++){
- if (keywordcmp(field,attr->a_att_field)==0 &&
attr->a_att_value!=NULL){
+ if (keywordcmp_ptr(field,attr->a_att_field)==0 &&
attr->a_att_value!=NULL){
return attr->a_att_value;
}
}
--
Do what you love because life is too short for anything else.
- [Linphone-developers] coreapi/sal_eXosip2_sdp.c keywordcmp bug,
Sami Farin <=