Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/pnm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c
index 17926f256f..a9771710c2 100644
--- a/libavcodec/pnm.c
+++ b/libavcodec/pnm.c
@@ -52,12 +52,13 @@ static void pnm_get(PNMContext *sc, char *str, int buf_size)
}
s = str;
- while (bs < end && !pnm_space(c)) {
- if ((s - str) < buf_size - 1)
- *s++ = c;
+ while (bs < end && !pnm_space(c) && (s - str) < buf_size - 1) {
+ *s++ = c;
c = *bs++;
}
*s = '\0';
+ while (bs < end && !pnm_space(c))
+ c = *bs++;
sc->bytestream = bs;
}