~ubuntu-branches/ubuntu/saucy/trousers/saucy

« back to all changes in this revision

Viewing changes to src/tcs/rpc/tcstp/rpc.c

  • Committer: Package Import Robot
  • Author(s): Pierre Chifflier
  • Date: 2012-06-18 22:22:21 UTC
  • mfrom: (0.1.22 sid)
  • Revision ID: package-import@ubuntu.com-20120618222221-kumdab5nrfx4kvyh
Tags: 0.3.9-1
* Imported Upstream version 0.3.9
* Refreshed Debian patches
* Removed patch 04-gcc46.patch, not required anymore

Show diffs side-by-side

added added

removed removed

Lines of Context:
181
181
 
182
182
int
183
183
setData(TCSD_PACKET_TYPE dataType,
184
 
        int index,
 
184
        unsigned int index,
185
185
        void *theData,
186
186
        int theDataSize,
187
187
        struct tcsd_comm_data *comm)
194
194
        offset = 0;
195
195
        if ((result = loadData(&offset, dataType, theData, theDataSize, NULL)) != TSS_SUCCESS)
196
196
                return result;
197
 
        if (((int)comm->hdr.packet_size + (int)offset) < 0) {
198
 
                LogError("Too much data to be transmitted!");
199
 
                return TCSERR(TSS_E_INTERNAL_ERROR);
200
 
        }
201
 
        if (((int)comm->hdr.packet_size + (int)offset) > comm->buf_size) {
 
197
 
 
198
        if ((comm->hdr.packet_size + offset) > comm->buf_size) {
202
199
                /* reallocate the buffer */
203
200
                BYTE *buffer;
204
201
                int buffer_size = comm->hdr.packet_size + offset;
229
226
 
230
227
UINT32
231
228
getData(TCSD_PACKET_TYPE dataType,
232
 
        int index,
 
229
        unsigned int index,
233
230
        void *theData,
234
231
        int theDataSize,
235
232
        struct tcsd_comm_data *comm)
236
233
{
237
234
        UINT64 old_offset, offset;
238
 
        TCSD_PACKET_TYPE *type = (TCSD_PACKET_TYPE *)(comm->buf + comm->hdr.type_offset) + index;
 
235
        TCSD_PACKET_TYPE *type;
 
236
 
 
237
        if ((comm->hdr.type_offset + index) > comm->buf_size)
 
238
                return TSS_TCP_RPC_BAD_PACKET_TYPE;
 
239
 
 
240
        type = (comm->buf + comm->hdr.type_offset) + index;
239
241
 
240
242
        if ((UINT32)index >= comm->hdr.num_parms || dataType != *type) {
241
243
                LogDebug("Data type of TCS packet element %d doesn't match.", index);