summaryrefslogtreecommitdiff
path: root/formats/format_gsm.c
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2004-04-15 16:02:42 +0000
committerMark Spencer <markster@digium.com>2004-04-15 16:02:42 +0000
commita3d9d7b58b80fa8de7d197067675786e051114d3 (patch)
tree27bcfd3420d505259e7988a591eae49bcf1df627 /formats/format_gsm.c
parentde51a91db38c0d57a956dbb73d29f3458fdfafab (diff)
Do proper bounds checking in formats (bug #1356)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2694 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'formats/format_gsm.c')
-rwxr-xr-xformats/format_gsm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/formats/format_gsm.c b/formats/format_gsm.c
index 4ac2b5a5d..d58039e6d 100755
--- a/formats/format_gsm.c
+++ b/formats/format_gsm.c
@@ -197,9 +197,10 @@ static int gsm_seek(struct ast_filestream *fs, long sample_offset, int whence)
offset = distance + cur;
else if(whence == SEEK_END)
offset = max - distance;
+ // Always protect against seeking past the begining.
+ offset = (offset < min)?min:offset;
if (whence != SEEK_FORCECUR) {
offset = (offset > max)?max:offset;
- offset = (offset < min)?min:offset;
} else if (offset > max) {
int i;
lseek(fs->fd, 0, SEEK_END);