Mercurial > hg > th-libs
comparison th_ioctx_mem.c @ 718:ffd97ca9dfce
Check for length > 0.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 11 Nov 2020 13:23:24 +0200 |
parents | e73200c4584a |
children | d51c277bea6b |
comparison
equal
deleted
inserted
replaced
717:e73200c4584a | 718:ffd97ca9dfce |
---|---|
189 { | 189 { |
190 nmemb = (ctx->memSize - ctx->memOffset) / size; | 190 nmemb = (ctx->memSize - ctx->memOffset) / size; |
191 length = size * nmemb; | 191 length = size * nmemb; |
192 } | 192 } |
193 | 193 |
194 memcpy(buf, ctx->memData + ctx->memOffset, length); | 194 if (length > 0) |
195 ctx->memOffset += length; | 195 { |
196 memcpy(buf, ctx->memData + ctx->memOffset, length); | |
197 ctx->memOffset += length; | |
198 } | |
199 | |
196 return nmemb; | 200 return nmemb; |
197 } | 201 } |
198 | 202 |
199 | 203 |
200 static int th_mem_fputc(int ch, th_ioctx *ctx) | 204 static int th_mem_fputc(int ch, th_ioctx *ctx) |