C ライブラリーの gets 関数は、本質的に安全ではないため使用すべきではありません。
バッファーサイズを越える入力を防ぐことができないため、 代わりに同等で安全な fgets 関数を使用してください。
ID |
問題箇所 |
説明 |
---|---|---|
1 |
呼び出し位置 |
関数が呼び出された場所 |
#include <stdio.h> char buffer[256]; char * get_a_line() { // if next input line is longer than 256 this will corrupt memory // better is return fgets(buffer, sizeof(buffer), stdin); return gets(buffer); }
© 2010 Intel Corporation. 無断での引用、転載を禁じます。