Project

General

Profile

Bug #20

size_t vs ssize_t for evbuffer_copyout

Added by Nitesh Mor almost 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
07/19/2016
Due date:
% Done:

0%


Description

evbuffer_copyout returns a type of ev_ssize_t, which maps to ssize_t allowing for signed values. It returns the number of bytes read, or -1 if we can't drain the buffer.

ev_ssize_t evbuffer_copyout (struct evbuffer *buf, void *data_out, size_t datlen)

However, source:gdp/gdp_buf.c#L110 just uses size_t. A simple fix would be just to correct it to ssize_t, but that would change the API. What's a good fix?


Related issues

Related to GDP - Bug #15: Assertion error in Python API Closed 07/18/2016

History

#1 Updated by Nitesh Mor almost 7 years ago

  • Related to Bug #15: Assertion error in Python API added

#2 Updated by Eric Allman almost 7 years ago

  • Status changed from New to Closed

Changed it to return 0 instead of -1 on error. The error can only occur if you have called evbuffer_freeze on it, which we don't use, so this is (probably) a "can't happen" condition.

Also available in: Atom PDF