~ubuntu-branches/ubuntu/lucid/mpg123/lucid

« back to all changes in this revision

Viewing changes to control_generic.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kobras
  • Date: 2004-09-07 15:57:57 UTC
  • Revision ID: james.westby@ubuntu.com-20040907155757-pgypftl9bt2uqyyl
Tags: 0.59r-16
* layer2.c: Fix buffer overflow in layer2 decoder (CVE ID CAN-2004-0805).
* Makefile: Fix compiler options to build for generic targets on ARM,
  but optimise for xscale. Closes: #261255
* README.3DNOW, dct36_3dnow.s, dct64_3dnow.s, decode_3dnow.s,
  decode_i386.c, equalizer_3dnow.s, getcpuflags.s, layer3.c, mpg123.c,
  mpg123.h, tabinit.c, debian/rules: Apply patch by KIMURA Takuhiro and
  Syuuhei Kashiyama to fix errors in 3dnow-optimised decoding.
  Thanks to Alberto Garcia for the patch-merging. Closes: #242212
* debian/prerm: De-register mp3-decoder alternative. Closes: #222982
* debian/changelog: Convert to utf8.
* debian/control: Bump standards version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
198
198
                if (n > 0) {
199
199
                        int len;
200
200
                        char buf[1024];
201
 
                        char *cmd;
 
201
                        char *cmd, *ret;
202
202
 
203
203
                        /* read command */
204
 
                        len = read(STDIN_FILENO, buf, sizeof(buf)-1);
205
 
                        buf[len] = 0;
 
204
                        ret = fgets(buf, sizeof(buf)-1, stdin);
206
205
 
207
206
                        /* exit on error */
208
 
                        if (len < 0) {
209
 
                                fprintf(stderr, "Error reading command: %s\n", strerror(errno));
 
207
                        if (!ret) {
 
208
                                if (feof(stdin))
 
209
                                        break;
 
210
                                
 
211
                                fprintf(stderr, "Error reading command: %s\n",
 
212
                                        strerror(errno));
210
213
                                exit(1);
211
214
                        }
212
215
 
 
216
                        len=strlen(buf);
 
217
 
213
218
                        /* strip CR/LF at EOL */
214
219
                        while (len>0 && (buf[strlen(buf)-1] == '\n' || buf[strlen(buf)-1] == '\r')) {
215
220
                                buf[strlen(buf)-1] = 0;
235
240
                                        rd->close(rd);
236
241
                                        mode = MODE_STOPPED;
237
242
                                }
238
 
                                open_stream(filename, -1);
 
243
                               if (open_stream(filename, -1) < 0)
 
244
                                       continue;
239
245
                                if (rd && rd->flags & READER_ID3TAG)
240
246
                                        generic_sendinfoid3((char *)rd->id3buf);
241
247
                                else