From: Christian H. <ch...@us...> - 2003-12-27 00:31:47
|
Update of /cvsroot/gaim/gaim/src/protocols/msn In directory sc8-pr-cvs1:/tmp/cvs-serv19209 Modified Files: msnobject.c Log Message: Although it's not supposed to be possible, someone had a crash from a truncated MSNObject string. This adds some extra safe-guards in parsing. Index: msnobject.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/msn/msnobject.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -p -r1.3 -r1.4 --- msnobject.c 8 Sep 2003 01:47:58 -0000 1.3 +++ msnobject.c 27 Dec 2003 00:31:43 -0000 1.4 @@ -26,7 +26,8 @@ { \ tag += strlen(id "=\""); \ c = strchr(tag, '"'); \ - obj->field = g_strndup(tag, c - tag); \ + if (c != NULL) \ + obj->field = g_strndup(tag, c - tag); \ } #define GET_INT_TAG(field, id) \ @@ -35,8 +36,11 @@ char buf[16]; \ tag += strlen(id "=\""); \ c = strchr(tag, '"'); \ - strncpy(buf, tag, c - tag); \ - obj->field = atoi(buf); \ + if (c != NULL) \ + { \ + strncpy(buf, tag, c - tag); \ + obj->field = atoi(buf); \ + } \ } MsnObject * |