Update of /cvsroot/playerstage/code/player/client_libs/libplayerc
In directory 
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1803/client_libs/libplayerc

Modified Files:
        dev_map.c client.c 
Log Message:
fixed stack overflow in libplayerc map proxy
small formatting cleanups
changed error return in poll timeout to be clearer
added exception catch to playerprint


Index: client.c
===================================================================
RCS file: /cvsroot/playerstage/code/player/client_libs/libplayerc/client.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -C2 -d -r1.81 -r1.82
*** client.c    21 Sep 2007 03:31:50 -0000      1.81
--- client.c    17 Oct 2007 20:28:35 -0000      1.82
***************
*** 126,129 ****
--- 126,134 ----
      if(errno == EINTR)
        return(0);
+     else if (ret == 0)
+     {
+       PLAYERC_ERR("poll call timed out with no data to recieve");
+       return ret;
+     }
      else
      {
***************
*** 658,668 ****
    struct timeval curr;
    player_msghdr_t req_header, rep_header;
  
    if(deviceinfo == NULL)
    {
-     req_header.addr.host = 0;
-     req_header.addr.robot = 0;
      req_header.addr.interf = PLAYER_PLAYER_CODE;
-     req_header.addr.index = 0;
      req_header.type = PLAYER_MSGTYPE_REQ;
    }
--- 663,671 ----
    struct timeval curr;
    player_msghdr_t req_header, rep_header;
+   memset(&req_header, 0, sizeof(req_header));
  
    if(deviceinfo == NULL)
    {
      req_header.addr.interf = PLAYER_PLAYER_CODE;
      req_header.type = PLAYER_MSGTYPE_REQ;
    }
***************
*** 837,840 ****
--- 840,844 ----
  {
    player_device_req_t req, *resp;
+   resp=NULL;
  
    req.addr.host = 0;
***************
*** 961,964 ****
--- 965,970 ----
      if (nbytes <= 0)
      {
+       if(nbytes == 0)
+         return -1;
        if(errno == EINTR)
          continue;

Index: dev_map.c
===================================================================
RCS file: /cvsroot/playerstage/code/player/client_libs/libplayerc/dev_map.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** dev_map.c   20 Sep 2007 23:15:47 -0000      1.11
--- dev_map.c   17 Oct 2007 20:28:35 -0000      1.12
***************
*** 80,85 ****
  {
    playerc_device_term(&device->info);
!   if(device->cells)
!     free(device->cells);
    free(device);
  }
--- 80,84 ----
  {
    playerc_device_term(&device->info);
!   free(device->cells);
    free(device);
  }
***************
*** 100,104 ****
  {
    player_map_info_t *info_req;
!   player_map_data_t data_req, *data_resp;
  
    int i,j;
--- 99,103 ----
  {
    player_map_info_t *info_req;
!   player_map_data_t *data_req, *data_resp;
  
    int i,j;
***************
*** 151,154 ****
--- 150,154 ----
    assert(sx * sy < (int)(PLAYER_MAP_MAX_TILE_SIZE));
    oi=oj=0;
+   data_req = (player_map_data_t *)malloc(sizeof(player_map_data_t));
    while((oi < device->width) && (oj < device->height))
    {
***************
*** 156,168 ****
      sj = MIN(sy, device->height - oj);
  
!     memset(&data_req,0,sizeof(data_req));
!     data_req.col = oi;
!     data_req.row = oj;
!     data_req.width = si;
!     data_req.height = sj;
  
      if(playerc_client_request(device->info.client, &device->info,
                                PLAYER_MAP_REQ_GET_DATA,
!                               (void*)&data_req, (void**)&data_resp) < 0)
      {
        PLAYERC_ERR("failed to get map data");
--- 156,168 ----
      sj = MIN(sy, device->height - oj);
  
!     memset(data_req,0,sizeof(data_req));
!     data_req->col = oi;
!     data_req->row = oj;
!     data_req->width = si;
!     data_req->height = sj;
  
      if(playerc_client_request(device->info.client, &device->info,
                                PLAYER_MAP_REQ_GET_DATA,
!                               (void*)data_req, (void**)&data_resp) < 0)
      {
        PLAYERC_ERR("failed to get map data");
***************
*** 171,174 ****
--- 171,175 ----
        free(unzipped_data);
  #endif
+       free(data_req);
        return(-1);
      }
***************
*** 183,186 ****
--- 184,188 ----
        free(device->cells);
        free(unzipped_data);
+       free(data_req);
        return(-1);
      }
***************
*** 208,211 ****
--- 210,214 ----
      }
    }
+   free(data_req);
  
  #if HAVE_ZLIB_H


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to